Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

DLookup function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lmossolle - 03 May 2007 12:45 GMT
Could someone please shed some light and assist with the config on this one?

Here is the code I use,
=DLookUp("[NAME]","[BRAGG]","[SSN] = Forms![NAME]")

I want to scan a SSN using a Bar Code Scanner into the form called IAG, I
want to populate the name from a bragg table into the IAG Form.

It will not populate as of yet.

Thanks,
Lee
Rick Brandt - 03 May 2007 12:50 GMT
> Could someone please shed some light and assist with the config on this one?
>
[quoted text clipped - 5 lines]
>
> It will not populate as of yet.

Your final argument points at a form, but not at a specific control on that
form.  It should be...

Forms!NameOfForm!NameOfControl

If this is the same form that you are using the DLookup() in then an alternative
syntax is...

=DLookUp("[NAME]","[BRAGG]","[SSN] = '" & Me![NAME] & "'")

By the way you should not have an field or control named "NAME" as that is a
reserved word.  Change to EmployeeName, UserName, or similar.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

Allen Browne - 03 May 2007 12:56 GMT
Concatenate the value from the form into the 3rd string, like this:
   =DLookUp("[NAME]","[BRAGG]","[SSN] = """ & Forms![Form1]![NAME] & """")

For an explanation of the quotes, see:
   Quotation marks within quotes
at:
   http://allenbrowne.com/casu-17.html

Hopefully you don't really have a field named "Name".
Will cause all sorts of problems.
There's a list of names to avoid here:
   http://allenbrowne.com/AppIssueBadWord.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Could someone please shed some light and assist with the config on this
> one?
[quoted text clipped - 9 lines]
> Thanks,
> Lee
lmossolle - 03 May 2007 13:07 GMT
Does this need to go on the Name Field? When I put a SSN in the name does not
populate

Thanks!!!

> Concatenate the value from the form into the 3rd string, like this:
>     =DLookUp("[NAME]","[BRAGG]","[SSN] = """ & Forms![Form1]![NAME] & """")
[quoted text clipped - 22 lines]
> > Thanks,
> > Lee
Allen Browne - 03 May 2007 16:58 GMT
Yes. Replace Form1 with the name of your form.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Does this need to go on the Name Field? When I put a SSN in the name does
> not
[quoted text clipped - 27 lines]
>> >
>> > It will not populate as of yet.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.