[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!! :D
Re: Access VBA: "Run-time Error 2001"
is staffcode a string?
VB Code:
sForename = DLookup("[staffForeName]", "staff", "[staffCode] = '" & sCode & "'")
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
Re: [RESOLVED] Access VBA: "Run-time Error 2001"