Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stupid question

Status
Not open for further replies.

chipearly

Technical User
Joined
Jun 19, 2003
Messages
12
Location
US
This has been racking my brain, and for some reason I just cannot figure it out. I have 2 fields. The first one is from a lookup list that a user selects a Plant. The next field is for the Division the Plant chosen is in, and I want it to fill in when the users picks a plant in the previous field. At the moment I have each of these fields in a seperate table. Should they be in the same one? This is an example:

Plant - Iowa
Division - North America
 
Back off and ask yourself what you want to do. Then develop the structure for your table(s). A wise man oonce said, "If I have an hour to do a job, I will plan for 40 minutes."


rollie@bwsys.net
 
if the 2 tables are related, you can have the data stored in 2 tables because the DLookup function allows you to use tables or queries as recordsets.

to me, the easiest way would be if they existed in the same table, but that's just my opinion.

you may also need to add a refresh to the on change event of your combo box before the DLookup will autofill.

i hope this helps.
 
There is no such thing as a "stupid question." As far as I can tell, I was not born with knowledge of Access and (practically) the only way I have learned anything is by asking questions on this forum.

So, if you knew everything about Access, you would not be on this forum. Thus, there are no stupid questions; just stuff you don't know, okay?

Here's something else to think about (after you have pondered Rolliee's sage advice):


Fill Fields automatically on form based on a control's value
Author(s)
Erika Yoxall

(Q) Is it possible to have some fields filled in automatically as soon as a certain value has been entered into another field?

(A) A typical example of this is getting state and city name from Zipcodes. If you have a Zip-Code table, you'll never have to enter the State/City again. Add this simple code in the OnExit() event-handler for the field containing the Zipcode.

'************* Code Start **************
' This code was originally written by Erika Yoxall.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Erika Yoxall
'
Sub Zip_OnExit(Cancel As Integer)
Dim varState, varCity As Variant
varState = DLookup("State", "tblZipCode", "ZipCode =[Zip] ")
varCity = DLookup("City", "tblZipCode", "ZipCode =[Zip] ")
If (Not IsNull(varState)) Then Me![State] = varState
If (Not IsNull(varCity)) Then Me![City] = varCity
End Sub
'************* Code End **************

© 1998-2003, Dev Ashish & Arvin Meyer, All rights reserved.


"The potentialities of a language are so vast that we must wonder sometimes at ourselves: how do we manage to know so much?" Anthony Burgess, A Mouthful of Air
 
Thanks Judge, that has more sense than some of the crazy things I have been trying to do. I will give this a try tomorrow when I get into work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top