If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Autofill Form Fields
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. |
#2
|
|||
|
|||
Autofill Form Fields
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 & """" -- Dave Hargis, Microsoft Access MVP "Erika" wrote: 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. |
Thread Tools | |
Display Modes | |
|
|