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

Tip: Looking for answers? Try searching our database.

Autofill Form Fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erika - 15 May 2008 14:27 GMT
I am using a form as a look up for people to be able to enter a product and
then have aisle, level, and position automatically fill in so people in the
warehouse can locate a specific product.

How do I set that up?  I am finding a lot of information on event procedures
but I am not a strong Access user and I am unfamiliar with that.
Klatuu - 15 May 2008 16:21 GMT
The usual way to do a lookup for a specific record in a form is to use an
unbound combo box.  In most cases, (using your example) a product will have a
code that is the primary key of the product table and it will have a
description understandable to humans.  The combo box needs to have a query as
its row source that will present a list of products to the user.  It needs
two columns - one for Access to be able to find the record (the primary key
field) and one for the human to read (the description field).  It is a good
practice to show only the description field.  The user doesn't need to see
the product code.  So the query would look something like:

SELECT ProductID, ProductDescr FROM tblProduct ORDER BY ProductDescr;

Then set the combo's properties like this:

Bound Column = 1
Column Count = 2
Column Widths = 0";3"  (the 0 hides the Id, the 3 can be whatever needed to
show the entire description)
Limit To List = Yes

Now when the user selects a product from the combo, you have to locate the
product's record and make it the current record.  This you do in the combo's
After Update event.  Here is sample code to do that:

Private Sub MyCombo_AfterUpdate()

   With Me.RecordsetClone
       .FindFirst "[ProductID] = " & Me.MyCombo
       If Not .NoMatch Then
           Me.Bookmark = .Bookmark
       End If
   End With

This line assumes ProductID is a number field in the table:
       .FindFirst "[ProductID] = " & Me.MyCombo
If it is a text field, the syntax is:
       .FindFirst "[ProductID] = """ & Me.MyCombo & """"

Signature

Dave Hargis, Microsoft Access MVP

> I am using a form as a look up for people to be able to enter a product and
> then have aisle, level, and position automatically fill in so people in the
> warehouse can locate a specific product.
>
> How do I set that up?  I am finding a lot of information on event procedures
> but I am not a strong Access user and I am unfamiliar with that.
 
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.