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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RECORDSOURCE PROPERTY

Status
Not open for further replies.

Maggie24

IS-IT--Management
Jun 29, 2004
36
IE
Hi all,

In my program I have a combo box based on Primary Product Categories where by the user can select a value,
I want to fill a second combo box with fields based on the value selected in combo box (1) when i click a button

i thought I could just put a sql statement in the rowsource property of the second combo box like so:

Private Sub Update_Primary_Click()

Combo55.RowSourceType = "Table/Query"
Combo55.RowSource = " SELECT tblClassification.[Secondary Material Category] FROM tblClassification WHERE tblClassification.[Primary Material Category]= '" & Combo43.Value & "'"

End sub
This is all I have - do I need to use a record set or something - can someone show me how i would use the record set within my code as I am quite new to access and am confused.

Thank you for your help,

Confused Access Beginner
 
If this doesn't work, try adding a

[tt]Combo55.Requery[/tt]

after assigning the sql string, perhaps try this in the after update event of the first combo, and please do tell us what doesn't work, errormessages etc...

Roy-Vidar
 
Set the Row Source up on the second combobox first. eg.

SELECT DISTINCT [Fieldforcombo2] FROM table WHERE Fieldforcombo2 Is Not Null And MatchingFieldname =Screen.Activeform![Firstcomboname];

Then in the AfterUpdate of your first combobox put:

Me![secondcomboname].Requery
Me![secondcomboname].SetFocus
Me![secondcomboname].Dropdown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top