How to create Search form for database.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stang02GT
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #16
    Originally posted by ali3n8
    Can you highlight for me what areas in this code i need to edit I may have edited it incorrectly. Here is what I did below:
    Code:
    Private Sub ButtonsName_Click()
       If IsNull([B]Contact Number[/B]) = False Then
          Me.Recordset.FindFirst '[Contact Number]=' & [B]Contact Number[/B]
          Me!Contact Number = Null
          If Me.Recordset.NoMatch Then
             MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
                Me![B]Contact Number [/B] = Null
          End If
       End If
    End Sub

    Is this anybetter?..... ............... .......
    Last edited by Frinavale; Feb 11 '11, 09:34 PM.

    Comment

    • ali3n8
      New Member
      • Aug 2007
      • 50

      #17
      So here is what my code looks like now:
      Code:
      Private Sub Contactbut_Click()
         If IsNull(Contactnum) = False Then
            Me.Recordset.FindFirst '[Contact Number]=' & Contactnum
            Me!Contactnum = Null
            If Me.Recordset.NoMatch Then
               MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
                  Me!Contactnum = Null
            End If
         End If
      End Sub
      Last edited by Frinavale; Feb 11 '11, 09:32 PM. Reason: Added code tags.

      Comment

      • Stang02GT
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #18
        Ok...did it work??????????

        Comment

        • ali3n8
          New Member
          • Aug 2007
          • 50

          #19
          No it didnt unfourtunately would you mind if I emailed my db to you? Or if there is a way for me to post it here or tranfer to you via IM.

          Comment

          • Jim Doherty
            Recognized Expert Contributor
            • Aug 2007
            • 897

            #20
            Originally posted by ali3n8
            No it didnt unfourtunately would you mind if I emailed my db to you? Or if there is a way for me to post it here or tranfer to you via IM.
            Ali,

            I have this afternoon created an AC2000 database for you that deals specifically with your introduced question. It is a flexible method of searching across any number of fields in combination with each other. If you use your imagination with the demo sample you will quickly realise that it can be adapted for many areas. The sample assumes you are familar with VBA code (and you eventually will be)
            I have only just joined this forum this afternoon and cannot see an upload button? and to post the code in itself might be to intensiveif you PM me I,ll send you the database in zipped format ( and anyone else for that matter who might benefit as a developer)

            Comment

            • Stang02GT
              Recognized Expert Top Contributor
              • Jun 2007
              • 1206

              #21
              Originally posted by ali3n8
              No it didnt unfourtunately would you mind if I emailed my db to you? Or if there is a way for me to post it here or tranfer to you via IM.

              Sure PM me and i'll give you my e-mail address

              Comment

              • Jim Doherty
                Recognized Expert Contributor
                • Aug 2007
                • 897

                #22
                Search Demo

                Anyone who might benefit in reading this:

                As requested attached is the Access 2000 Search demo database I refer to earlier in this thread. (a zip file so extract to anywhere on your hard drive) There a a couple of other goodies thrown in like exporting the resultset to excel and so on.

                Take a look at the code behind the forms It works for version 2000 and 2003 (note however if version 2007 it will fail due to an apparent lack of response in that a subform will only show the first record albeit the recordsource of the subform is being set at runtime)

                Regards

                Jim
                Attached Files
                Last edited by Frinavale; Feb 14 '11, 04:11 PM. Reason: Removed reference to deleted post

                Comment

                • sandyinfinite
                  New Member
                  • Feb 2011
                  • 24

                  #23
                  Very Nice creation and works in 2007 also
                  Thank you all who involving

                  Sandip

                  Comment

                  • Jim Doherty
                    Recognized Expert Contributor
                    • Aug 2007
                    • 897

                    #24
                    In response to a request I received recently I am reposting the file I contributed 3 years ago in 2011 it is in now in ACCDB format for those of you so wishing to learn from the techniques therein.

                    Basically ignore the previous MDB format and go with this ACCDB format rejigged for Access 2007 through to Access 2013

                    Regards

                    Jim Doherty
                    Attached Files

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32633

                      #25
                      For anyone else wishing to ask questions related to anything included in this thread, but not directly related to the original question of the thread and by the original poster, these are hijacks if posted in this thread, and will be deleted, but are perfectly reasonable questions when posted in their own thread separately.

                      You can even post links to this thread from your new one AND, if you think it will help to be noticed by members already involved in this thread, you can also post in here with a link to your new question thread. All that you mustn't do is to ask your new question in here.

                      Comment

                      • Rhonda F
                        New Member
                        • May 2011
                        • 4

                        #26
                        I know this is an old thread, but THANK YOU for this. It is extremely helpful.

                        Comment

                        Working...