A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Autofill Form Fields



 
 
Thread Tools Display Modes
  #1  
Old May 15th, 2008, 02:27 PM posted to microsoft.public.access.forms
Erika
external usenet poster
 
Posts: 249
Default 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  
Old May 15th, 2008, 04:21 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.