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!

Setting RowSource based on another field in Access97

Status
Not open for further replies.

wyld

Programmer
Apr 23, 2001
28
0
0
US

I have a form that uses 4 reason codes. Based on the reason code, different fields are visible/invisible. Two of the reason codes (A and B) using the same combo box but display different values.

Based on the reason code, I want to use a different query to get the information for Error Reason.

For reason code A, I want to populate the field using qryA.

For reason code B, I want to populate the field using qryB.

(qryA and qryB are selecting information from the same table)

How can I do this? I'm assuming I need to code some sort of Event but I'm not sure what.

Thanks in advance
 
Try this, change the blue to match the name of your Combo Box (If that is what you are using to select your reason code), change the green to match the values in the Combo Box...

Private Sub Combo0_AfterUpdate()

If Me.Combo0 = "A" Then
Me.RecordSource = "qryA"
Me.Requery
ElseIf Me.Combo0 = "B" Then
Me.RecordSource = "qryB"
Me.Requery
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top