Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95

    Unanswered: Can 'find' retrieve multiple values?

    I now have smt simple with findfirst:

    Dim Usrvar As Long
    Dim dbcurr As Database
    Set dbcurr = CurrentDb

    Dim rsRecords As Recordset
    Set rsRecords = dbcurr.OpenRecordset("main", dbOpenDynaset)

    rsRecords.FindFirst "Kamernrs = " & kamernummers

    If Not rsRecords.NoMatch Then
    Usrvar = rsRecords!USRID.Value
    Else: Usrvar = 0
    End If

    This of course retrieves only one record, but is it possible (with 'find' maybe?) to retrieve multiple records and assign them (from one field) to a combo-box? What would be the correct syntaxis?

    thx again

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Maybe I'm oversimplifying your question, but it looks like you are trying to have a combo box display certain values based on what is in a text box.

    Set the row source property for the combo box to a sql statement like:
    SELECT field2
    FROM tblMain
    WHERE "Kamernrs = " & forms!main!kamernummers
    Inspiration Through Fermentation

  3. #3
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by RedNeckGeek
    Maybe I'm oversimplifying your question, but it looks like you are trying to have a combo box display certain values based on what is in a text box.

    Set the row source property for the combo box to a sql statement like:
    SELECT field2
    FROM tblMain
    WHERE "Kamernrs = " & forms!main!kamernummers
    Thats idd oversimplified because the problem lies that the another combobox has to control what values this second combobox has. First combobox shows officenumbers, second combobox (depending on the officenumber) should show walloutlets(numbers)...
    I dont think I can add variables into row source property?

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    It should still work. Based on the value selected in one combo box, you want another combo box to be limited to a list of values.

    Modifying my code a little bit:

    SELECT field2
    FROM tblMain
    WHERE Kamernrs = forms!main!cmbBox1
    Inspiration Through Fermentation

  5. #5
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by RedNeckGeek
    It should still work. Based on the value selected in one combo box, you want another combo box to be limited to a list of values.

    Modifying my code a little bit:

    SELECT field2
    FROM tblMain
    WHERE Kamernrs = forms!main!cmbBox1
    Yeh I was fiddling around with it a bit already but the syntax doesnt seem to work yet...

    It should be forms!(NameOfForm)!(NameOfCmbobox) right? That should return the value currently on display in that combobox? Thx

  6. #6
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    That's right. Use
    Forms![formname]![fieldname]
    Make sure to use the square brackets.
    Inspiration Through Fermentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •