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

need help with code for combo box

18
hi i have a form with a combo box and two text boxes on it.
i want it set up so when a selection is made from the combo box the two text boxes will display the corresponding data from the table.

the table name is: New Plymouth
the fields included in the table: Destination
Kilometres One Way
Kilometres Return

the name of the combo box : Dest
the first text box: Kms
the 2nd text box: Kms1

the combo box displays the destinations from the table, i want the Kms text box to display the one way kms and i want the Kms1 text box to display the return kms.

i currently have the following code which works fine with one text box but i am un sure what changes are required to make it work for two text boxes.

the code is:

after update in the combo box

Private Sub Dest_AfterUpdate()
Me!Kms = Me!Dest.Column(1)
End Sub

can anyone please help me???????
May 29 '07 #1
7 1673
Rabbit
12,516 Expert Mod 8TB
hi i have a form with a combo box and two text boxes on it.
i want it set up so when a selection is made from the combo box the two text boxes will display the corresponding data from the table.

the table name is: New Plymouth
the fields included in the table: Destination
Kilometres One Way
Kilometres Return

the name of the combo box : Dest
the first text box: Kms
the 2nd text box: Kms1

the combo box displays the destinations from the table, i want the Kms text box to display the one way kms and i want the Kms1 text box to display the return kms.

i currently have the following code which works fine with one text box but i am un sure what changes are required to make it work for two text boxes.

the code is:

after update in the combo box

Private Sub Dest_AfterUpdate()
Me!Kms = Me!Dest.Column(1)
End Sub

can anyone please help me???????
Expand|Select|Wrap|Line Numbers
  1. Private Sub Dest_AfterUpdate()
  2. Me!Kms = Me!Dest.Column(1)
  3. Me!Kms1 = Me!Dest.Column(2)
  4. End Sub
  5.  
May 30 '07 #2
tranzit
18
thanks for the help but i already tryed that and it didn't work i can't work out why???
May 30 '07 #3
tranzit
18
the statement i have in the combo box row source is as follows:
SELECT * FROM [New Plymouth] ORDER BY [New Plymouth].Destination;

is there something worng with this????

it works fine with the first text box but nothing appears in the second text box
May 30 '07 #4
Rabbit
12,516 Expert Mod 8TB
the statement i have in the combo box row source is as follows:
SELECT * FROM [New Plymouth] ORDER BY [New Plymouth].Destination;

is there something worng with this????

it works fine with the first text box but nothing appears in the second text box
Interesting... it should work perfectly fine. The one time something like this happened to me was because I had overlapping names. Check all field names in the recordsource, function names in the modules, variable names, etc. and see if you've given more than one thing the same name.
May 31 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Interesting... it should work perfectly fine. The one time something like this happened to me was because I had overlapping names. Check all field names in the recordsource, function names in the modules, variable names, etc. and see if you've given more than one thing the same name.
Check the Column Count property under the format tab. It should be set to at least 2 if you want to use both the first and second column
Jun 1 '07 #6
tranzit
18
thanks for the help it was the column count that needed changing...
THANKS EVERYONE :)
Jun 4 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
thanks for the help it was the column count that needed changing...
THANKS EVERYONE :)
You're welcome.

Glad you got it sorted.

Mary
Jun 5 '07 #8

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

Similar topics

5
by: MARK | last post by:
Hi, I have a printer consumables database. I have a form designed to change the status of consumables ie. in use, dead, stock etc. I select one of my consumables records from the combo box...
2
by: Smythe32 | last post by:
Hi, I have this code below that will add a new item to a combo box if it is not in the combo box. I also would like the user to add the description for the new addition to the combo box and...
2
by: CSDunn | last post by:
Hello, In an Access 2000 ADP subform, I have a set of two Radio buttons in a single group that are bound to a field called 'Completed'. The Completed field comes from an SQL Server 2000 table, is...
3
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
2
by: Uninvisible | last post by:
I have put together a db for a law firm to keep track of counterfeit activities. There are four parent tables: tblContact tblTransaction tblAction tblFile I have created a form,...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
28
by: jverri01 | last post by:
First, I am relatively new to working with variables. Most of my experience has been with interface design. i am using ACCESS ver. 2003, running in Windows XP. Second, I spent an hour searching...
18
by: Richard Penfold | last post by:
I have a form with a subform in my database that I use to manage deliveries. A combo box on the subform displays items of inventory and thier current status. The code behind the combo box is......
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
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
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
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
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.