473,796 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Autopopulate then save in a table

51 New Member
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.co lumn(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 1895
PianoMan64
374 Recognized Expert Contributor
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.co lumn(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
GLEberts
51 New Member
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.colu mn(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 Recognized Expert Contributor
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.colu mn(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
GLEberts
51 New Member
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 - "tblZipcode s" - 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 Recognized Expert Contributor
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 - "tblZipcode s" - 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
GLEberts
51 New Member
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
3669
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 field (Product Description). When the user selects an item from the drop down (IE 12S0FB) it will autopopulate the text field with a description of the product. At the
2
760
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 unit price and a monthly maximum charge auto-populate in the subform (both values are in the "equipment" table as well). Why am I having such a tough time with this? Have tried to create a form/subform with both the wizard and the...
3
1474
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 post, from a Microsoft employee i belief, and he stated the following: >3) The AutoPopulate feature doesn't work as well as I
0
1096
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 accomplished with an AutoPopulate feature but I am unable to figure this out. For example, I add a new label with my key in C:\Inetpub\wwwroot\ToolkitSamples\Basic\default.aspx. What next steps do I take to AutoPopulate the key in the Samples application?
3
3662
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 has a list of counties Field B has a list of capital cities I want to select Ireland from the dropt down in field 1 and field 2 should autopopulate with Dublin. The values of the fields have to be: Field 1 = IRELAND Field 2 = DUBLIN
5
7248
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 autolookup queries but do not know how to mirror this in a form. I am not experienced with Visual Basic...meaning I have played around in it but haven't been successful...if I have some guidance I am sure I could plug in the right fields to...
4
3150
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 have a customer ID field, customer name field, parts, time, cost. The customer name is part of the customer table while the rest of the data is part of the "order" table. Looking for the code that would autopopulate the customer name field based...
2
1702
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 a feedback form for each session. So I have put hidden 6 tabs with subforms on each tab linked back to tbl_feedback..... So far I have it set up so that when a date field next to a session number on first tab is changed it opens appropriate tab...
3
1961
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 this so please let me know how I would be able to perform this task. First, I have a table with field 1: units and field 2: has the corresponding battalions. I have a form that has the combo box for units and battalions. I want the battalion combo...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.