473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Fill multiple fields based on one entry

Access 2000. I want to be able to enter a zip code in field one and have the related city, state and supervisor filled into field 2, 3 and 4.

Currently I add the zip code to a table, field one and then use an update query to fill in the values in field 2, 3 and 4. I use a second table with the lookup values for zip, city, state and supervisor.

I would like to update each record as I enter the zip code. Would it be best to create a form or should I create the fields in the table so they look up the correct value.
Jul 21 '07 #1
1 3544
ADezii
8,834 Expert 8TB
Access 2000. I want to be able to enter a zip code in field one and have the related city, state and supervisor filled into field 2, 3 and 4.

Currently I add the zip code to a table, field one and then use an update query to fill in the values in field 2, 3 and 4. I use a second table with the lookup values for zip, city, state and supervisor.

I would like to update each record as I enter the zip code. Would it be best to create a form or should I create the fields in the table so they look up the correct value.
Assuming your Zip Code Field is Numeric, in the AfterUpdate() Event of the Zip Code Field, write code similiar to:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtZipCode_AfterUpdate()
  2. If Not IsNull(Me![txtZipCode]) Then
  3.   Me![txtCity] = DLookup("[City]", "tblLookup", "[ZipCode]=" & Me![txtZipCode])
  4.   Me![txtState] = DLookup("[State]", "tblLookup", "[ZipCode]=" & Me![txtZipCode])
  5.   Me![txtSupervisor] = DLookup("[Supervisor]", "tblLookup", "[ZipCode]=" & Me![txtZipCode])
  6. End If
  7. End Sub
Jul 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ogilby1 | last post by:
Using an immediate if to fill a field on a form based on the value of another field. During data entry on the form this methodology works well. When looking at the results in the datasheet view or...
4
by: Sherwood Botsford | last post by:
Table Markers ID (Primary Key) This&That PointClass (Combo box) Points Table PointClasses PointClass (primary key) Points (number) Description (Text)
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
5
by: Kaur | last post by:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two...
0
by: CanFlightSim | last post by:
I use combo boxes and a great little piece of code to fill a form with a record set. For example I want to search by Lastname and fill the form or by company and fill the form, I will start typing...
4
by: Deus402 | last post by:
Here is my table design: tblEmployers EmployerID autonum (primary key) EmployerName text tblLocations LocationID autonum (primary key) EmployerID longint (foreign key) LocationAdress text
1
by: natwong | last post by:
Hi All, I'm hoping that someone could help me out since I'm new with Access. Background: Database was set up as a simple data entry and reporting tool for Program Initiatives. The data...
1
by: Jason Northampton | last post by:
Hello This is the first time I've used a discusion forum and up until now I have managed to use and or modify VB code from the various sites on the web, until now! This is a simple problem and I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.