How do I have a combo box limit number of records in form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Combo box that pulls information down into a form. I want to limit
the record in the form to the one record selected. Any suggestions?
 
You could use the AfterUpdate event procedure of the unbound combo to set
the RecordSource of the form to a SQL string that contains just that one
record.

Example:

Private Sub cboFilterClientID_AfterUpdate
Dim strSql As String
If Not IsNull(Me.cboFilterClientID Then
If Me.Dirty Then Me.Dirty = False 'Save first.
strSql = "SELECT * FROM tblClient WHERE ClientID = " &
Me.cboFilterClientID & ";"
Me.RecordSource = strSql
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top