473,396 Members | 1,917 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,396 software developers and data experts.

Autopopulate then save in a table

Hi,
I would like to ask for some direction on what would be the best way to
(1) Autopopulate a combo box to text boxes - used for a customer list
(2) Then have the information saved in the table?

NOTE: I have already tried this method with 50% success - it works but does not save to the table.
control source of the text box - comboboxname.column(n)

First Question? What is the best method to to autopopulate then save to a text box?
Second Question? Should I run the combo box off of a query?

Thanks for your help
Gary
Mar 29 '08 #1
6 1873
PianoMan64
374 Expert 256MB
Hi,
I would like to ask for some direction on what would be the best way to
(1) Autopopulate a combo box to text boxes - used for a customer list
(2) Then have the information saved in the table?

NOTE: I have already tried this method with 50% success - it works but does not save to the table.
control source of the text box - comboboxname.column(n)

First Question? What is the best method to to autopopulate then save to a text box?
Second Question? Should I run the combo box off of a query?

Thanks for your help
Gary
Gary, I need to have more information as to why you're wanting to do what you describe. I can't understand under any reasoning of mine, why that would ever be considered as an option?

Can you explain what it is that you're trying to do? Also include any table and query structures that you've created already so I'm able to re-create your senerio.

Thanks,

Joe P.
Mar 30 '08 #2
Joe P.
First off you have probably guessed that I am in database 101 design. One of my strenghts I beleive is to ask the experts and not move forward until it is working properly. I have spent some time researching basics of databases and have discovered that I have first made a mistake in saving the same information in different tables. with that said I can explain what I am trying to acheive.
I. Customer list with a combo box for (City,State and Zip)
A. I wanted to be able to autopopulate the city, state and zip from a drop
down box from "City" then autopopulate state and zip.
B. How I have done that so far is create a combo box bound to "cboCity"
C. In the text box city and state I used =lablename.column(n)
D. In form view the correct information is displayed but the state and city
is not saved in the table.

II. What I then wish to do is make other forms that pull the customer
information and insert it as a combox box that I only have to click on the
customer name and the informaion is also autopopulated into it.

Thanks for your reply and any constructive adivce is appreciated
Gary
Mar 30 '08 #3
PianoMan64
374 Expert 256MB
Joe P.
First off you have probably guessed that I am in database 101 design. One of my strenghts I beleive is to ask the experts and not move forward until it is working properly. I have spent some time researching basics of databases and have discovered that I have first made a mistake in saving the same information in different tables. with that said I can explain what I am trying to acheive.
I. Customer list with a combo box for (City,State and Zip)
A. I wanted to be able to autopopulate the city, state and zip from a drop
down box from "City" then autopopulate state and zip.
B. How I have done that so far is create a combo box bound to "cboCity"
C. In the text box city and state I used =lablename.column(n)
D. In form view the correct information is displayed but the state and city
is not saved in the table.

II. What I then wish to do is make other forms that pull the customer
information and insert it as a combox box that I only have to click on the
customer name and the informaion is also autopopulated into it.

Thanks for your reply and any constructive adivce is appreciated
Gary
Ok Gary,

I'm going to pass along some concepts to you, that you're going to need to understand before we proceed any further.

1. When you create a customer list, there is going to be a Primary Key value for each of those customer. i.e. a Account number for each customer. You include things in the table that are going to be unique to that customer. Name, address, zipcode, phone, cell, email, etc.

2. if you have create a list of zipcodes with City and state already defined, then using the Zipcode as the Primary key, then you would simply store the Key value (i.e. the zipcode) in the customer table, and lookup the rest of the information. That way you don't have to store the value of the city and state in the customer table. you simply look it up by the zipcode.

So now that we have that in place, you may be asking, how do i get it to display the city and state for a given zipcode?

well that is a good question. there is a function within access called dlookup()

this function is used to populate information based on something that is entered (in your case) in another field.

the syntax for that is:

Expand|Select|Wrap|Line Numbers
  1. DLOOKUP("The name of the field you want to display","Table Name","Criteria to locate the particular item")
  2.  
  3. ----------------------------------------------------------
  4. example:
  5. ----------------------------------------------------------
  6. me.City = DLOOKUP("cboCity","Zipcodes","[ZipCode]=" & me.zipcode)
  7.  
Where me.city refers to the control on your form that is called City, and the me.zipcode refers to the combo box control that is named Zipcode.

then you simply use the onEvent Procedure BeforeUpdate, and it will update the field City.. and you do the same thing for the state, just replace the city field with the state field in both your form and your table that has the zipcodes in it, and you can display both city and state.

Hope that helps,

Joe P.
Mar 31 '08 #4
Good Morning,
I appreciate your reply with an explaination instead of just script. I showed me the "why" instead of just the "how"

This is what I have done.

(1) Table - "tblZipcodes" - which has "Zipcode" as the (PK)
(2) Combo box on the form - "cboZip" with the control source set to "Zip/Providence that is bound to the form.
I am having a challange putting the rest together without getting an error.

Next I made a unbound txt box for the city
The next step is what I believe I am doing incorrect.
Where to insert the code "DLOOKUP"
I am putting it in the control source in the text box "City"
Then clicking on "EventProcedure" in the BeforeUpdate
With the info above could you please steer me in the correct direction.
I really am starting to enjoy this and have looked into some classes at a local community college. I can see already that in order to do this you need to have some type of prfessional education to understand the concepts of what to do. To start up blind like I am doing is nuts.
Thanks for your Help!
Gary
Apr 1 '08 #5
PianoMan64
374 Expert 256MB
Good Morning,
I appreciate your reply with an explaination instead of just script. I showed me the "why" instead of just the "how"

This is what I have done.

(1) Table - "tblZipcodes" - which has "Zipcode" as the (PK)
(2) Combo box on the form - "cboZip" with the control source set to "Zip/Providence that is bound to the form.
I am having a challange putting the rest together without getting an error.

Next I made a unbound txt box for the city
The next step is what I believe I am doing incorrect.
Where to insert the code "DLOOKUP"
I am putting it in the control source in the text box "City"
Then clicking on "EventProcedure" in the BeforeUpdate
With the info above could you please steer me in the correct direction.
I really am starting to enjoy this and have looked into some classes at a local community college. I can see already that in order to do this you need to have some type of prfessional education to understand the concepts of what to do. To start up blind like I am doing is nuts.
Thanks for your Help!
Gary
yes, you can simply put the DLOOKUP in the control Source of the control, just make sure that you have a conditional statement so that it doesn't show #ERROR before you populated the Zipcode field with a valid zipcode from the ZipCodes table.

Example that will go into the control source for the city control

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIF(IsNull[ZipCode]),"",DLOOKUP("City","Zipcodes","[Zipcode]=" & [Zipcode]))
  3.  
  4.  
just paste that in to the city control.

Same with the state as well:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIF(IsNull([Zipcode]),"",DLOOKUP("State","Zipcodes","[ZipCode]=" & [Zipcode]))
  3.  
  4.  
that's all you have to do. You don't need to do any event updating. It will take care of it when you populate the zipcode field.

Hope that helps,

Joe P.
Apr 1 '08 #6
Thanks for you help - this allowed me to move forward.
Thanks
Gary
Apr 2 '08 #7

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

Similar topics

2
by: Dave | last post by:
Hi folks, I'm in the middle of adding some validation functionality to an inventory tracking form. What I would like to do is have one dropdown menu/Listbox(Part Number) and another text...
2
by: Fork_In_Road | last post by:
I have a main form with customer names & addresses, and a subform that I want to have the following: I wish to pull up an equipment name with a combo box (from my "equipment" table); then have the...
3
by: Eric | last post by:
Hi, I'm just looking into the samples that are delivered withthe Enterprise Localization Framework/Toolkit. I have set it up and it all works fine. But.. now i have a question. I read a...
0
by: guy | last post by:
I am experimenting with the Enterprise Localization Toolkit. Using the Designer and Translator feature, I am able to include a new label in the Basic sample. Apparently, this can also be...
3
by: russr | last post by:
Hi, I need to autopopulate a second field based on the info that i have selected from a drop down box in the first field. I need to write both fields back to a SQL database... EXAMPLE: Field A...
5
by: aharding | last post by:
I would like to autopopulate fields in a form by choosing one value from a table and having the corresponding data filled in based on 'Library' tables I have made. I have been successful in building...
4
by: PRLIT | last post by:
First, let me just say that I've been looking at this site for help for awhile now. Thank you for all the help you given me over the past few months. Second, I'm creating a form in Access 2007. I...
2
by: debson | last post by:
Hi I have a main form in which I have linked subforms on tabs.. My problem is that I have one subform which is linked to a table which has 2 to 6 sessions in one table, we are required to fill out...
3
by: hkim8392126 | last post by:
I've been searching and reading the forum, but with no success to find what I was looking for. I am trying to autopopulate a field in a form. I am not sure if I need to create a query or table to do...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...

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.