|
-
Jul 18th, 2006, 08:38 AM
#1
Thread Starter
Member
[RESOLVED] Access VBA: "Run-time Error 2001"
Im getting an error with this bit of code:
VB Code:
Dim sForename As String
Dim sSurname As String
Dim sCode As String
sCode = DLookup("staffCode", "booking", "bookingDate = #" & dDate & _
"# AND timeID = " & timeID & " AND areaID = " & areaID)
sForename = DLookup("[staffForeName]", "staff", "[staffCode] = " & sCode)
sSurname = DLookup("staffSurName", "staff", "staffCode = " & sCode)
MsgBox "The booking has already been booked by " & sForename & " " & sSurname
Its screwing up on the "sForename = DLookup" line.... and the "sSurname = Dlookup" line
Any help would be appriciated!!
Last edited by c03cg; Jul 18th, 2006 at 09:23 AM.
-
Jul 18th, 2006, 09:04 AM
#2
Re: Access VBA: "Run-time Error 2001"
is staffcode a string?
VB Code:
sForename = DLookup("[staffForeName]", "staff", "[staffCode] = '" & sCode & "'")
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 18th, 2006, 09:22 AM
#3
Thread Starter
Member
Re: Access VBA: "Run-time Error 2001"
How dim do i feel! Yes its a string and i read they needed to be in quotes..... just forgot to add it in!!
Thanks Fella
-
Jul 18th, 2006, 10:04 AM
#4
Re: [RESOLVED] Access VBA: "Run-time Error 2001"
Fella? lol 
no problem
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
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
|