INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Requery a form based on 3 cmbbox columns

Requery a form based on 3 cmbbox columns

(OP)
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)

RE: Requery a form based on 3 cmbbox columns

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

Duane
Hook'D on Access
MS Access MVP

RE: Requery a form based on 3 cmbbox columns

(OP)
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) & "'"

RE: Requery a form based on 3 cmbbox columns

So what do you get when you do this:

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
 

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close