Hi,
This VB code causes two errors:
Function GetTimeEntry(SerNum)
Dim SQLString
Dim AcctNum
Dim SerNum
set MyDB = CreateObject("ADODB.Connection")
MyDB.Open "GATER"
SQLString = "SELECT time.* FROM [time] where time.serial = '" & SerNum & "';"
'MsgBox SQLString
set rsTime = MyDB.Execute(SQLString)
If Not rsTime.EOF then
AcctNum = rsTime.Fields("account")
Else
AcctNum = "Not Found"
End if
MyDB.Close
GetTimeEntry = AcctNum
End Function
but if I take out the DIM statements, I'm oK.
Here are the VBscript runtime errors:
Error 1041, Line 5, Column 5, "name redefined"
Error 13, Line 2, Column 0 "Type mismatch: 'GetTimeEntry'"
Get rid of the dims, and the code runs fine.... why?
Should I care?
Tx,
George
Unexpected VB Error
Moderators: JRL, Dorian (MJT support)
Unexpected VB Error
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Off the top of my head, untested, not used VB in a while.......:
Have you tried?
1.
set SQLString = "Select ........
And/Or
2.
Does SQLString need a semicolon ";" at the end?
I think the second message is because SQLString failed in the first message. I think using "set" will correct the first error, and that fix will eliminate the second error message.
Have you tried?
1.
set SQLString = "Select ........
And/Or
2.
Does SQLString need a semicolon ";" at the end?
I think the second message is because SQLString failed in the first message. I think using "set" will correct the first error, and that fix will eliminate the second error message.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi,
The problem is you have declared SerNum twice. Remove the Dim SerNum statement. It is already declared in the function header. SerNum is the variable which contains the value passed to the function.
The problem is you have declared SerNum twice. Remove the Dim SerNum statement. It is already declared in the function header. SerNum is the variable which contains the value passed to the function.
MJT Net Support
[email protected]
[email protected]