By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

variable (long) as criteria for Dlookup

P: n/a
Hello all,
I want to perform a DLookup function with a variable (long) as critera.
I know if it was a string this would be the correct syntax :
Me!txtStad.Value = DLookup("[Name]", "tblPostnummers", "[Id] = '" &
sBoxvalue & "'")
Can anybody give me the correct syntax when boxvalue is a number (long) (In
that case it would be called nBoxvalue.
I don't seem to understand the delimiting :(:(:(
Any help appreciated ....
Thanks
Ronny Sigo
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Me!txtStad = DLookup("[Fieldname]". "tblPostnummers","[Id] = " & nBoxValue)

Note that when using a number for the criteria that there is no need for the
apostrophe before and after the variable. I've removed the .Value from your
syntax because .Text is the default property.
Warning! Don't use the word "Name" as a field name because it is a reserved
word in Access and it may cause problems down the track.

Stewart
"Ronny Sigo" <ro*********@erfgoednet.be> wrote in message
news:3f**********************@feed0.news.be.easyne t.net...
Hello all,
I want to perform a DLookup function with a variable (long) as critera.
I know if it was a string this would be the correct syntax :
Me!txtStad.Value = DLookup("[Name]", "tblPostnummers", "[Id] = '" &
sBoxvalue & "'")
Can anybody give me the correct syntax when boxvalue is a number (long) (In that case it would be called nBoxvalue.
I don't seem to understand the delimiting :(:(:(
Any help appreciated ....
Thanks
Ronny Sigo

Nov 12 '05 #2

P: n/a
Thanks Stewart :)
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> schreef in bericht
news:bl**********@news.wave.co.nz...
Me!txtStad = DLookup("[Fieldname]". "tblPostnummers","[Id] = " & nBoxValue)
Note that when using a number for the criteria that there is no need for the apostrophe before and after the variable. I've removed the .Value from your syntax because .Text is the default property.
Warning! Don't use the word "Name" as a field name because it is a reserved word in Access and it may cause problems down the track.

Stewart
"Ronny Sigo" <ro*********@erfgoednet.be> wrote in message
news:3f**********************@feed0.news.be.easyne t.net...
Hello all,
I want to perform a DLookup function with a variable (long) as critera.
I know if it was a string this would be the correct syntax :
Me!txtStad.Value = DLookup("[Name]", "tblPostnummers", "[Id] = '" &
sBoxvalue & "'")
Can anybody give me the correct syntax when boxvalue is a number (long)

(In
that case it would be called nBoxvalue.
I don't seem to understand the delimiting :(:(:(
Any help appreciated ....
Thanks
Ronny Sigo


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.