Forms, Subforms troubles

KITT

New member
Local time
Today, 20:55
Joined
Mar 29, 2007
Messages
7
hey,

I am new in MS Access programming, so here is a very trivial question:

I have one table with guitarbrand, guitarmodel, id, owner...

I have one combobox where I can choose the guitarbrand, and one where I can choose the guitarmodel. then I want to see the corresponding information below (id, owner..). I guess that's where subforms fit in. But I don't know how to handle this.

One remark: If I try to view the form in VIEW-mode, I get a popup field where I have to type in the guitarmodel. Afterwards it shows the subform corresponding to the model. BUT I don't wanna type the model, I want to choose it from the second combobox after having chosen the guitar brand.

please help!

thanks,
KITT
 
attach sample to see problem, maybe I can help you
 
hey zzteam, thanks for your offer!

there is just a small problem. it's a bank's database. so the guitar values are fake.

but anyway, I almost got it: Since the values come from the same table, I don't need any form. I just need to know, how to write the values into corresponding textfields.

Combobox1 named cmb_Type with value = Gibbson
Combobox2 named cmb_Name with value = FlyingV

and below I just put for all other fields of the table corresponding textboxes. the first one shows the ModelOwner and its name is text51.

I tried like
Code:
Me.Text51 = SELECT ModelOwner FROM tbl_Guitars WHERE Guitar_Name = cmb_Name.Value

But it doesn't work out. If I delete this part "= SELECT ModelOwner FROM tbl_Guitars WHERE Guitar_Name", the textbox gives me the guitar name, so the approach is quite good. but the select statement is not accepted.

I hope you can use that information and help me? Otherwise just tell me if I confused you.

cheers,
KITT
 
Sorry, but my english is not good.
Maybe I can help you on your DB.
 
You don' need a subform, you don't need 2 combo.
Look at attachment, (test form).
 

Attachments

hi MStef,

it's not about what I need, it's about what my boss wants :/

So the first combobox you can select the type, then in the second you select the specific model of the guitar. and AFTERWARDS you get all information about the specific model displayed.

What you send me, is just the records. but there is no way to preselect one special guitar type.

cheers,
alex
 
In combo choose ID, and populate next 3 fields from combo box.
 
In combo choose ID, and populate next 3 fields from combo box.
how does that work? and I guess you mean the second combobox. because the first one shows all guitartypes. if you choose one specific, you have the possible models in the second combobox. that works for now.

but if I click the second combobox I want all details about it.
 
In the rowsource of the second combo box, it should be a query and not a table, so then you can include the fields you want to display. Then, just set the properties:
Number of Columns: to the correct amount you chose (the default is 1, so you have to change this)
Column Width: 0";1.5",0",0"... (set the column widths for the columns you included in the rowsource and set those you want in the combo but not to display while someone looks at the combo box drop down)

Then, in the AfterUpdate event of the combo box, put something like:

Me.YourTextBoxNameWhereYouWantDetails = Me.YourComboBoxName.Column(2)
Me.YourTextBoxNameWhereYouWantDetails2 = Me.YourComboBoxName.Column(3)

That would display the details in two textboxes for two columns that you chose from your combo (starting with the 3rd column (2) since the second column (1) would likely be displayed by your combo box itself.)
 

Users who are viewing this thread

Back
Top Bottom