Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combobox for multiple fields 2

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
0
0
US
If I have a table that has these fields:

SrvChrgSize SrvChrgAmt
fld3-2wk 30.00
fld3-6mo 120.00
fld75-2wk 60.00
fld75-6mo 140.00

How would I do the combo box that lets them select the field and corresponding charge?
Currently I have 4 columns horizontal but that's not what I'm really looking for.
I need the combo box to be vertical with 2 columns.

I am currently on office 2010 but they are upgrading us to 2016
Thanks
 
Lhuffst,
You have started almost 200 threads and should understand how to use TGML to make your posts more readable.

Can you use TGML and show us your actual table, fields, and data? Then use TGML to show us how you want this represented in the combobox.

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
dhookom said:
You have started almost 200 threads and should understand how to use TGML to make your posts more readable.

In, in fact, you have already done so, multiple times, after been given the same advice before!

Are the Fields SrvChrgSize and SrvChrgAmt in a single Table? If so, base your Combobox on that Table and include both Fields. You can do that by simply using the COmbobox Wizard.



Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007
 
DHookom
My apologies. I thought that for so few lines it wouldn't be hard to read. I'll correct that in the future.

Yes I have done combo boxes and can use the wizard but this is slightly different so I wasn't sure.

Code:
TblFees 

Fields:
fld2wk3inSvcChrg
fld6mo3inSvcChrg
fld2wk75inSvcChrg
fld6mo75inSvcChg

[pre][COLOR=#3465A4] svcChrgAmt is the actual values for each field above[/color][/pre]
If I use the wizard, I get the following showing in the combo box:
[pre]fld2wk3inSvcChrg fld60mo3inSvcChrg fld2wk75inSvcChrg fld6mo75inSvcChrg
40 130 40 130
120 120 30 120[/pre]

What I would like the combobox to look like is
[pre]fld2wk3inSvcChrg 40
fld6mo3inSvcChrg 120
fld2wk75inSvcChrg 40
fld6mo74inSvcChrg 120[/pre]

Previously there was only one field in the table but due to different pricing now, I have to change it to multiple fields
I hope this is more clear and appreciate any help.
 
I hope you realize you have created an un-normalized table structure by storing data in field names. You should be able to normalize this with a union query.

I'm not sure how you got the values when there are two records.

SQL:
Select "fld2wk3inSvcChrg" as TheField, fld2wk3inSvcChrg as Charge
FROM tblFees 
UNION ALL
Select "fld6mo3inSvcChrg", fld6mo3inSvcChrg 
FROM tblFees
UNION ALL 
SELECT "fld2wk75inSvcChrg", fld2wk75inSvcChrg
FROM tblFees
UNION ALL
SELECT "fld6mo75inSvcChg",fld6mo75inSvcChg
FROM tblFees

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
I'm not sure how you got the values when there are two records."

Especially when you want this:

"What I would like the combobox to look like is"[pre]
fld2wk3inSvcChrg [blue]40[/blue]
fld6mo3inSvcChrg [blue]120[/blue]
fld2wk75inSvcChrg [blue]40[/blue]
fld6mo74inSvcChrg [blue]120[/blue] [/pre]

Out of this data:
[pre]
fld2wk3inSvcChrg fld60mo3inSvcChrg fld2wk75inSvcChrg fld6mo75inSvcChrg
[blue]40[/blue] 130 [blue]40[/blue] 130
120 [blue]120[/blue] 30 [blue]120[/blue] [/pre]

Aside from what the spelling of the field names are...

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
sorry it's been so long responding - I'm yanked from project to project it seems.
I was hoping to use as much original code as possible from the original coder.
Based on your forms I'm restructuring this one to be normalized. Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top