-
March 25th, 2025, 07:45 PM
#1
Newbie VB Help much appreciated
I am preforming a data integrity check by using a select count. i noticed that the developer was only passing 1 expression if Val(sRows) >1 but he forgot to check for zero record. I tried to change the code in the two variations below and syntax checks correctly but I do not get my error message. Can anyone assist me. please
'Step 2 - Data Integrity Check
sSql = "select count(*) from F5542EP where NRLOTN = '" & Rsp & "' " & _
" and NRYN01 = 'Y' and NRNREEPROM <> ''"
DB.Execute(sSql, sCols, sRows)
If Val(sRows) > 1 Then ' if val(srows) = 0 then
App.CallForm("FADERROR" & " -SNR=ESNR1", True)
Exit Sub
End If
Variations
If Val(sRows) > 1 Or Val(sRows) = 0 Then ' if val(srows) = 0 then
App.CallForm("FADERROR" & " -SNR=ESNR1", True)
Exit Sub
End If
If Val(sRows) <> 1 Then ' if val(srows) = 0 then
App.CallForm("FADERROR" & " -SNR=ESNR1", True)
Exit Sub
End If
-
March 26th, 2025, 04:35 AM
#2
Re: Newbie VB Help much appreciated
[You will probably receive more help re VB6 if you post to this site's sister site https://www.vbforums.com/forumdispla...-6-and-Earlier ]
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|