Results 1 to 14 of 14
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is there anyway of searching for records on a page (Access2000)

    Hi guys,
    I've got a access database with a page. I have a combo box on the page but when I select data on the combo box (which is bound to the primary key of the table that the page is based on), the combo box does not return the record for that value in the combo box.

    Please help me.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    I'm sure there will be plenty of other methods which much more able people than me will post, but the easiest way i have found is to use an unbound box and query on its contents

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    yep, you sure are a sentimental guy.
    Thank you for the help but it still doesn't work.
    Any other ways???

    <img src=/S/help.gif border=0 alt=help width=23 height=15>

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    What code have you got in the AfterUpdate event of the unbound combobox?

  5. #5
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    Haven't got any code.
    I thought the combo box wizard creates its own code.
    I'm no good when it comes to coding.
    I never had to do any coding for the combo boxes that I have in the forms.

    <img src=/S/confused.gif border=0 alt=confused width=15 height=20> & in need of <img src=/S/help.gif border=0 alt=help width=23 height=15>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    Why don't you delete the combo box that doesn't work and create a new one with the combo box wizard?

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    Use the wizard to generate an unbound combo box, use the 3rd option (I think) to generate the code for you.

  8. #8
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    I Have tried generating loads of new combo boxes and I'm NOT so good at coding.
    The combo box displays the list of Print Ques but when I select a printer it doesn't do anything.
    I want it to find the record for the printer I select in the combo box and display it on the page.

    I have no idea how I could do this.

    Regards
    Princess

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Is there anyway of searching for records on a page (Access2000)

    Look up RecordsetClone Property in on-line help for Access 2000. There is an example there that navigates to a record, and this is the standard method used with unbound comboboxes for this purpose. Here's the relevant sample from Help:

    <pre>Sub SupplierID_AfterUpdate()
    Dim rst As Recordset
    Dim strSearchName As String

    Set rst = Me.RecordsetClone
    strSearchName = Str(Me!SupplierID)
    rst.Find "SupplierID = " & strSearchName
    If rst.NoMatch Then
    MsgBox "Record not found"
    Else
    Me.Bookmark = rst.Bookmark
    End If
    rst.Close
    End Sub</pre>


    The combobox in the above code would be Me!SupplierID.
    Charlotte

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Is there anyway of searching for records on a page (Access2000)

    If the wizard created the code, you still have code tucked away in the page's module. That's what you would need to post if you want help.
    Charlotte

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    In the subject of this thread you mention a "page".

    If you mean a data access page, you can't use a combo box to search (at least, not with the standard tools.)

    If you mean a form, or a tabbed page on a form, the combo box wizard should be able to generate the code for you. One other thing: the form must be bound to a table or query; if the Record Source is empty, there is nothing to search for.

    As patt pointed out, if you place a combo box on a bound form, the combo box wizard will present three options:

    1. I want the combo box to look up the values in a table or query.
    2. I will type in the values that I want.
    3. Find a record on my form based on the value I selected in my combo box.

    You need the third option if you want to use the combo box for searching the form. The wizard will ask you which fields contain the values you want included in your combo box, etc. Answer the questions, and at the end, the wizard will create the combo box and the code needed to search your form; you don't even need to see the code. If it doesn't work, there may be a problem with the way your form is set up.

  12. #12
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    SORRY to confuse you all.
    I was talking about a data access page not a form.
    If a combo box wouldn't work, what do I use to search for a record on the data access page?

    Please <img src=/S/help.gif border=0 alt=help width=23 height=15> moi!

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    I am very sorry, but I can't help you here. There is no wizard that creates a search combo box on a data access page for you. You would have to write code in Visual Basic Script, which resembles but is not quite the same as Visual Basic for Applications, and you have indicated that coding is not your strong point.

  14. #14
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is there anyway of searching for records on a page (Access2000)

    Not to worry.
    Thank you!
    <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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