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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Is there anyway of searching for records on a page (Access2000)

    • This topic has 13 replies, 5 voices, and was last updated 22 years ago.
    Author
    Topic
    #388748

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #683891

      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

      • #684136

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

        help

        • #684139

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

          • #684473

            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.

            confused & in need of help

            • #684478

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

            • #684479

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

            • #684535

              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

            • #684538

              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:

              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

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

            • #684544

              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.

            • #684579

              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 help moi!

            • #684584

              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.

            • #685417

              Not to worry.
              Thank you!
              smile

            • #684539

              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.

    Viewing 0 reply threads
    Reply To: Is there anyway of searching for records on a page (Access2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: