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

Requery a form based on 3 cmbbox columns 1

Status
Not open for further replies.

cdgeer

IS-IT--Management
Apr 8, 2008
133
US
Could someone please tell me how I would go about requerying a form and subform based on all three columns in a combo box selection.

Basically like this:

Form has txtbx1, txtbx2, txtbx3, cmbbx.column(0),(1),(2) subform

When a user makes a selection in the cmbbx I want the whole form to requery Where txtbx1 = cmbbx.column(0) txtbx2 = cmbbx.column(1) txtbx3 = cmbbx.column(2)

 
Why would you need to requery anything if the control sources are:
[pre]=cmbbx.column(0)
=cmbbx.column(1)
=cmbbx.column(2)[/pre]
Changing the value of cmbbx should automatically display the correct values in the text boxes.

Duane
Hook'D on Access
MS Access MVP
 
The cmbbx works as a filter currently but, only filters for one field....

Private Sub cmbProjNameFilter_AfterUpdate()
Me.Filter = "[Project_Name] = '" & Me![cmbProjNameFilter] & "'"
Me.FilterOn = True
End Sub

Private Sub cmbProjNameFilter_LostFocus()
If Me.FilterOnLoad = False Then Me!cmbProjNameFilter = ""
End Sub


But, I want it to work something like this:

Private Sub cmbProjNameTTM_AfterUpdate()
Dim strSQL As String


Me.Filter = "[Project_Name] = '" & Me![cmbProjNameTTM].Column(0) & "'" And "[Project_Version] = '" & Me![cmbProjNameTTM].Column(1) & "'" And "[TTM_Phase] = '" & Me![cmbProjNameTTM].Column(2) & "'"

 
So what do you get when you do this:

[pre]Dim strFilter As String

strFilter = "[Project_Name] = '" & Me![cmbProjNameTTM].Column(0) & "'" & _
" And [Project_Version] = '" & Me![cmbProjNameTTM].Column(1) & "'" & _
" And [TTM_Phase] = '" & Me![cmbProjNameTTM].Column(2) & "'"

Debug.Print strFilter

Me.Filter = strFilter
[/pre]


Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top