473,406 Members | 2,619 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,406 software developers and data experts.

Auto filling multiple combo/list boxes

283 100+
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 3906
yarbrough40
320 100+
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 100+
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 100+
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 100+
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 100+
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 100+
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 Expert Mod 2GB
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 100+
I agree - that is an easier approach
Mar 17 '10 #9
slenish
283 100+
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
TheSmileyCoder
2,322 Expert Mod 2GB
In that case I would still use the same approach, and then when you type in something thats not in the combo's list, you can use the NotInList event to open a seperate form for editing this information.
Mar 17 '10 #11
slenish
283 100+
How would I use left join?

Like This?
Expand|Select|Wrap|Line Numbers
  1. SELECT tblA.id, IsNull([tblB].[id]) AS flgB, IsNull([tblC].[Id]) AS flgC
  2. FROM (tblA LEFT JOIN tblB ON tblA.id = tblB.id) LEFT JOIN tblC ON tblA.id = tblC.id;
Also if this is the right approcach that means I have to make 3 seperate tables and make an ID number to link each thing together right? Could I use this same approach with all combo boxs or does it have to be mixed with some text boxs?
Mar 17 '10 #12

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

Similar topics

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)
3
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...
11
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...
0
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...
6
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...
3
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...
3
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...
12
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...
4
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...
2
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.