Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Update a field based on another value entered on a form

Posted on 2011-05-01
6
Medium Priority
?
274 Views
Last Modified: 2012-05-11
I have a form where the user enters a customer's name and address.... all that goes into one table: tPatient

I also have another table (tZip) that contains two fields, zip and city.

I would like to set the main form so when the user enters the zip the City will automatcially update correctly on the form based on the users entered zip code for a particular customer.

How can this be done via VBA?

Thank you.
0
Comment
Question by:thandel
  • 4
  • 2
6 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 2000 total points
ID: 35502492
On the patient form, use a combo box for the zip code and a text box for the city.  Set the properties as follows:
   rowsource: "Select Zip, city from tZip"
   bound column = 0
   column count = 2
   

In the after update event of the combo box:
  me.CityTextboxName = me.ZipComboFieldName.column(1)
   

If you want to get fancy, you could make the city a combo box, as well and work it the other way.  Then, the user can choose the city/zip from either combo.



0
 

Author Comment

by:thandel
ID: 35502592
Thanks, when you say set the properities is that for the combo box and just leave the text box alone?

I tires this but after update the zip code the city text box remains null.
0
 

Author Comment

by:thandel
ID: 35502595
Ah sorry got it working had the rowselect incorect.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:thandel
ID: 35502597
Thanks!  Can't really go the other way as some cityies have more than one zip code.
0
 
LVL 42

Expert Comment

by:dqmq
ID: 35503174
I believe my solution had a typo:  bound column should = 1, not 0

>Can't really go the other way as some cityies have more than one zip code.

Not a problem...show both the city and the zip in the dropdown.  User can pick from among them:

RowSource:  Select city, zip from yourtable
Column Count = 2
Bound Column = 1




0
 

Author Comment

by:thandel
ID: 35504759
Thanks I've started another thread as new issues came up. 26988400  (Which looks like you jumped on too)  :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question