Share via

combo box problem

Anonymous
2013-07-16T01:24:33+00:00

i have a form with different textbox. I want to fill the textbox with the record selected in combobox and also i would like to count the record depending up on the record selected in the combobox in ms access form. Can anyone please help? Thank you

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

17 answers

Sort by: Most helpful
  1. Anonymous
    2013-07-22T16:43:58+00:00

    What do i need to do to view only records based on combo box value. it can be one record only or many records but i would like to restrict. Any advice please...

    Take a look at FindRecord.zip in my public databases folder at:

    https://skydrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    This simple little demo file includes two forms, one to go to a record, which I think is what you are currently doing, the other to filter the form, which is what I think you are attempting.

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,830 Reputation points Volunteer Moderator
    2013-07-22T12:19:18+00:00

    The combobox wizard that creates a search combo creates an UNBOUND control. This has to be unbound. Therefore when you use the navigation buttons to cycle from record to record, the unbound control doesn't change. If you want the search combo to reflect what is in the current record, put this code in the ON Current event fo your form:

    Me.combobox = Me.PrimaryKey

    Where combobox is name of the search combo and PrimaryKey is the name of the control bound to your primary key .

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-07-22T05:45:54+00:00

    Thank you; that is clearer.

    I think what you want to do is to change the Filter property of the form so that only those records which match the combo box are displayed. Assuming that your combo box is named cboMyCombo and that the Contract field is a Text field, You can do this with code like:

    Private Sub cboMyCombo_AfterUpdate()

    If IsNull(cboMyCombo) Then ' Clear the filter if nothing is chosen

       Me.Filter = ""

       Me.FilterOn = False

    Else

       Me.Filter = "[Contract] = '" & Me.cboMyCombo & "'"

       Me.FilterOn = True

    End If

    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-07-22T02:58:57+00:00

    Sorry for incomplete question, and thanks a lot for your response. I have a table with many records in fields Industry, State, Contract, Title, First_Name, Last_Name, etc. i filled the values of contract in combo box with wizard where i select third option: Find a record on my form based on the value i selected in my combo box. Now i populate the records in text box accordingly, BUT When i click next record it will show next records in text boxes and combo box value stays the same, which is untrue. What do i need to do to view only records based on combo box value. it can be one record only or many records but i would like to restrict. Any advice please...

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-07-16T01:47:32+00:00

    Not without knowing more about your database. A "Record" could have many fields; what do you want to see in the textbox? What is it you want to count? "Count the record" is meaningless - one record is, well, 1.

    And what is the textbox you want to "fill"? If you are trying to copy data from one table (the combo's row source) into another table (the textbox's control source), you probably should not be doing so; storing data redundantly is pretty much always a bad idea.

    What are the RowSource property of the combo box, the Recordsource property of your form, and the tables involved? How are the tables related, and what do they represent?

    Was this answer helpful?

    0 comments No comments