Dlookup syntax

Malcy

Registered User.
Local time
Today, 17:56
Joined
Mar 25, 2003
Messages
584
Hi
Terribly sorry but got another DLookup syntax problem. When I get solutions I record them and can usually recreate but this one is for a text criterion and also a numeric criterion which I don't seem to have had to do before.
What I have is
Code:
varRegister = DLookup("lngTsin", "dbo_tsin", "strEmp = " & Me.cboStaff & " And lngWeek =" & Me.cboWeekNo)
The format of the result from Me.cboStaff is like E0915 and from Me.cboWeekNo is 3
In the respective fields in the table dbo_tsin strEmp is a text field and lngWeek in a long integer.
I am pretty sure I have got the inverted commas right. Tried loads of combinations and this one went through without going into red so assumed (wrong again) it was OK.
Can any of you wizards help me out please?
Thanks in anticipation
Best wishes
 
DLookup("lngTsin", "dbo_tsin", "strEmp = '" & Me.cboStaff & "' And lngWeek =" & Me.cboWeekNo)

???
 
Thanks Ken
Tried that and got a compile error and it all went into red.
I can almost follow your logic too! Shame MS can't
Best wishes
 
Oops .. Apologies
I didn't copy it all across
I have done so now and it works
Thanks a million
Will drink a dram in your honour at Hogmanay
Come to that I will perhaps drink a lot of drams!!
 
You're welcome (I guess :)). What's a Hogmanay?
 
Hogmanay (pronounced with the main stress on the last syllable) is the Scots word for the celebration of the New Year in the Scottish manner. Its official date is the 31st of December. However this is normally only the start of a celebration which lasts through the night until the morning of the 1st or, in many cases, the 2nd of January.

en.wikipedia.org/wiki/Hogmanay

...hmmm...sounds better than watching that stupid ball with Dick Clark...
 
Bodisathva said:
...hmmm...sounds better than watching that stupid ball with Dick Clark...

True enough - :p

Never been drank to (too?:))...

Caused drinking in spite of :eek: (just kidding)
 
Got it in one
Cue massed Scotsmen and women all under the influence of uisge beath (OK water of life and since this is Scotland I guess you can work that one out!) and other alcoholic beverages. And Edinburgh currently proclaiming itself the global centre of Hogmanay.
Celebrations are starting tonight. I think this link describes it well
http://edinburghnews.scotsman.com/index.cfm?id=2471452005
Have fun - and yes, much better than watching balls, but then again waking up next day is less fun!
Take care
 

Users who are viewing this thread

Back
Top Bottom