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

How can I use a combo box to advance records on a form?

FZ
Hi Gang,
I was wondering if a generous person might be able to walk me
through what I believe is a pretty simple task. I actually have
significant Access experience, but I haven't done it in about 3 years
and I'm more rusty than I thought I was. Anyway, in a nutshell:

The scenario: 2 combo boxes (comboLastName and comboStateorProvince)
on a form with 30 text boxes, the form's recordsource has been set to
a query, both combo boxes and text boxes have been bound via the form
recordsource and display correct values. OK, no problems.

The problem: I need the textboxes to advance to the corresponding
record of the combo box value that has been selected. So, if I select
"Jones" from comboLastName, I want to see all of the data in the 30
text boxes and other combo box that corresponds to the "Jones" record.
Make sense? Pretty basic, right?

Now here are my specific questions:

1) I'm assuming that I need to write VBA code in the combo boxes'
events. Which event of comboLastName and comboStateorProvince should
I place the code? Change, DoubleClick, AfterUpdate?

2) I have the recordsource of the combo boxes set to the same query as
the recordsource of the form. The controlsource of each combo box
corresponds to the same field of the query (i.e.
comboLastName.controlsource = LastName, comboStateorProvince =
StateorProvince). Are these bindings correct?

3) I've written and re-written so much VBA code it's fairly useless to
ask what should I change, could anyone give me a few general
guidelines of what I should be coding here?

4) Any other general pointers or tips here on how I should go about
this?
Thank you SO MUCH for your help in advance. This has become quite
maddening, especially since I know this is so basic, but I need a
refresher. Thanks again!!
Nov 12 '05 #1
1 3296
A1: Use the AfterUpdate event of the combo.

A2: Use unbound combos, i.e. leave their Control Source completely blank.
You need to provide combos specifically for navigating, and you do not want
to store a value into a field of the current record.

A3. Code example.
There is a combo box wizard that can generate this code, but it's not very
good. For a more complete approach, see:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"FZ" <fl*******@hotmail.com> wrote in message
news:c7**************************@posting.google.c om...
Hi Gang,
I was wondering if a generous person might be able to walk me
through what I believe is a pretty simple task. I actually have
significant Access experience, but I haven't done it in about 3 years
and I'm more rusty than I thought I was. Anyway, in a nutshell:

The scenario: 2 combo boxes (comboLastName and comboStateorProvince)
on a form with 30 text boxes, the form's recordsource has been set to
a query, both combo boxes and text boxes have been bound via the form
recordsource and display correct values. OK, no problems.

The problem: I need the textboxes to advance to the corresponding
record of the combo box value that has been selected. So, if I select
"Jones" from comboLastName, I want to see all of the data in the 30
text boxes and other combo box that corresponds to the "Jones" record.
Make sense? Pretty basic, right?

Now here are my specific questions:

1) I'm assuming that I need to write VBA code in the combo boxes'
events. Which event of comboLastName and comboStateorProvince should
I place the code? Change, DoubleClick, AfterUpdate?

2) I have the recordsource of the combo boxes set to the same query as
the recordsource of the form. The controlsource of each combo box
corresponds to the same field of the query (i.e.
comboLastName.controlsource = LastName, comboStateorProvince =
StateorProvince). Are these bindings correct?

3) I've written and re-written so much VBA code it's fairly useless to
ask what should I change, could anyone give me a few general
guidelines of what I should be coding here?

4) Any other general pointers or tips here on how I should go about
this?
Thank you SO MUCH for your help in advance. This has become quite
maddening, especially since I know this is so basic, but I need a
refresher. Thanks again!!

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with...
3
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
1
by: No Spam | last post by:
Dear Access Users, I have a form with a combo box and a button on it. The combo box has a list of all the records in the database. When the user pushes the button, a macro runs that deletes...
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
7
by: Erich Kohl | last post by:
Okay, here's the deal: Let's say a form is based on a table. This form has Field1 (PrimeKey), Field2, Field3, etc. This form also has a subform which shows related records in another table....
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
9
by: cocacrispy | last post by:
I've read many forum posts and articles and haven't made any headway with this. Let me describe my tables and when I'm trying to do and see if any one can help me. I have an items table, a...
2
by: banderson | last post by:
Hello, I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.