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 / April 2008

Tip: Looking for answers? Try searching our database.

dlookup challanges

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
crmulle - 30 Apr 2008 20:59 GMT
I am struggling with a general lookup function.  I want the user to be able
to look up a vendor id or name from field with in a form and have the form
populate with the correct vendor information.  The fields (ex. Vendor ID,
Owning LOB, Risk Rating, Service Category, etc.) in this form are bound to a
table named tblImport This information in this table is static and doesn't
change until the monthly upload is complete.  Therefore, a user shouldn't be
able to edit the information

When I set up a combo box it allows me to edit the Vendor ID field (which
changes the tblImport table) and doesn't populate the other fields properly
in the form.

I tried using a dlookup and am stuck.  I have included my code below, but I
am not understanding the help information on dlookup...specifically the
criteria portion of the dlookup.  Would someone be able to give me some
direction on how to resolve this?

DLookup("[Vendor ID]", tblImport, "[Vendor ID]" =  Forms!frmMain2!VendorId)

PS - I even tried using an input box but they only accept strings and not
numbers...correct?  I have included my code for that as well.

Dim strVendorId As Variant

strVendorId = InputBox("Please enter the desired Vendor ID:", "Find")

DoCmd.GoToRecord "strVendorId"
Douglas J. Steele - 30 Apr 2008 22:17 GMT
Try putting the equal sign inside the quotes:

DLookup("[Vendor ID]", tblImport, "[Vendor ID] = " &
Forms!frmMain2!VendorId)

For the second option, putting the quotes around strVendorId means that it's
going to use that literal string. However, even if you removed the quotes
from around strVendorId in the GoToRecord method, it's not going to work,
because GoToRecord works with instruction telling it how many records you
want to move, not to move to a record with a specific value.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I am struggling with a general lookup function.  I want the user to be able
> to look up a vendor id or name from field with in a form and have the form
[quoted text clipped - 28 lines]
>
> DoCmd.GoToRecord "strVendorId"
 
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.