473,667 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto filling multiple combo/list boxes

283 Contributor
I have a new problem that I am playing with involving the combo boxes. Alright now im going to try to explain this as best I can and hope (NeoPa) doesnt notice if I mess up :D

This is going to be a tie in to what I was doing last time with the combo boxes and trying to make the auto-fill and update.

What im trying to do is make it so I can type information in to one Combo Box such as an ID number and it will look up on the table and pull the rest of the information associated with that ID number and auto fill in other combo boxes with the right information.

So for example (on my form), I have a box labeled Company ID, Then I also have another set of boxes with company location broken in to 3 boxes that have city, state, and zip code. What I want is if I type in the Company ID it will reference that with an ID number on my table and then fill in the other boxes with the matching City, State, and Zip.

Im hoping this is clear enough.
Mar 17 '10 #1
11 3936
yarbrough40
320 Contributor
have you tried using a DLookup in the OnChange() event of the box your typing into? Then inserting the returned value into your ComboBoxes?
Mar 17 '10 #2
slenish
283 Contributor
I wasnt sure if I should go with the DLookUp function or a code for doing a cascading combo/list box??

Also I read over the DLookUp function more. Would I put that function in each box or only the ID number box and it will know to fill in the other boxes?
Mar 17 '10 #3
yarbrough40
320 Contributor
you will need to put it in the OnChange() event of the box where your users are inputting the ID number. The code you write in that event will handle adding the items into the combo boxes. (I'm assuming you are familiar with writing VBA code in event procedures)
Mar 17 '10 #4
slenish
283 Contributor
Im not real familar with VBA code yet. Im trying my best. I have this so far for the DLookUp.
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[Facility City]", "Facility Info Test 2", _
  2.       "[Facility ID] = Form![Facility ID]")
Except im getting an error saying, "Expected line number, or statement, or end of statement. Im not sure what I need to declare at the beginning of this??
Mar 17 '10 #5
yarbrough40
320 Contributor
ok so looks like you're getting there... forgive me but I am not in a place where I have an instance of Access to refer to but I believe you are missing "&" in your third parameter to properly concatenate your string... like so:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  =DLookUp("[Facility City]", "Facility Info Test 2", _
  3.        "[Facility ID] = " & Form![Facility ID]")
what you will want to do is (in the OnUpdate() event of the box being typed into only):
  • declare a string variable
  • assign the value of that variable to the result of the DLookup()
  • insert the variable's value into your combo boxes
Mar 17 '10 #6
slenish
283 Contributor
Ok here is where I am now.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim FacilityID As String
  3.  
  4. Me!txtFacilityID = DLookup("[Facility City]", "tblFacilityInfo","[Facility ID] = & "Form![Facility ID])
  5.  
  6.  
Now you said insert the variables value into the other boxes. Do I use an if statement? Or just something like txtFacilityID = Combo20. Im not sure the right way to declare this?

also im getting an error message still saying I need a list seperator at the part I highlighted. Any idea what im missing?

Really appercaite the help. Also who is the person in your picture?? I feel like i know that face but cant place it.
Mar 17 '10 #7
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
If the secondary boxes are just for displaying the info, I would do a left join in my recordsource, and simply pull the data in via the query. Once you fill in the combobox the textboxes will be automatically filled.
Mar 17 '10 #8
yarbrough40
320 Contributor
I agree - that is an easier approach
Mar 17 '10 #9
slenish
283 Contributor
Well the other boxes are not just for displaying information that is part of the problem.

See right now I have a list of about 100 ID's that go with different locations. So I wont be using this same 100 over and over, I will also be updating the 100 as well. So I want to make it so if I type in an ID that is new I can type in the city, state, and zip to go along with it and it will save it on the back end for later use.
Mar 17 '10 #10

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

Similar topics

4
4708
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)
3
2366
by: MatGyver | last post by:
I am going nuts trying to figure this out, any help will be appreciated. I have an existing table called "Parts". And in this table I have the following columns: "ID" "Part Number" "Part Description" "Part Cost" I am trying to build an order form that will have "Part Number" and "Part Cost" both on the form and in that forms specific table.
11
4517
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
0
1597
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number of text and combo boxes on it (in panels on the tab). These combos were originally simple drop down lists - i.e. you had to select from the list and couldn't enter anything of your own. At that time everything worked fine. Now, the users...
6
9414
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate report" button located on my form to print all of the list box values (that have been updated via selection from combo boxes) from the form to the report. I've tried using a macro with the code: Macro Name: cmdGenerateReport : On Click Action:...
3
6186
by: Alo2aaa | last post by:
Dear all i have two linked combo boxes (master/child) ,the user wants to have multiple selection from both combo boxes , can u tell me how can i store them in a way that i can have a unique id for the selected items from the first combo box and also to the items selected from the second combo box? because i want to retrieve them in a search page ex: Combo box1:"Fruits","drinks","vegetables". Combo box 2:"apple","banana","mango". when...
3
3976
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment list will 'display in the drop down list of CboSegment With Me! If IsNull(Me!cboDivision) Then
12
4029
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just not several, to report using this code i found - Private Sub cmdPreview_Click()
4
3159
by: sree078 | last post by:
I've a list of items which I bound to multiple combo boxes. In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo boxes...How should I do that... As when I'm trying to add an item...it is being shown in all the combo boxes. private void FillMethod() { BindingSource bs = new BindingSource(); BindingSource bs1 = new BindingSource(); ...
2
3034
by: hollinshead | last post by:
hi there, i have been having this issue for quite some time now and i cant seem to get my head around it. I am trying to create a database for candidates CV's and covering letters. basically the data that is stored is made up of qualifications and areas of business that candidate is involved etc. My problem is with the query by form where i have a range of combo boxes and list boxes. The combo boxes are working fine, no problem however the...
0
8457
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
8365
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
8563
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
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
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
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2776
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
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.