Can anyone tell me how to create a search box using visual basic that will search a data base?
-
I'm bit of a novice when it comes to program using visual basic. I have my vb program set up and my database as well. In my program I have a Search command button that will show an inputbox that will enable me to type what I want to search the database for. i.e. the membership number of a customer. The code for my search button is below: Private Sub cmdSearch_Click() Dim searchvar As String searchvar = InputBox("Enter the Membership Number you wish to find", "Fitness Freaks Search") With adoMembers.Recordset Dim bMark As Variant bMark = .Bookmark .MoveFirst .Find "MembershipNumber = '" & searchvar & "%'" If .EOF Or .BOF Then .Bookmark = bMark MsgBox "Membership Number " & searchvar & " not found." End If End With End Sub When I execute this I get an error message (3265). Can anyone help me? Thanks tmcpolin
-
Answer:
3625 is an "Item not found in this collection" error. It can be a couple things: EOF not being handled correctly or Sometimes column name not found in that table, which might be syntax. Try using a loop to check EOF and see if this 'Find' syntax works better: searchvar = searchvar & "%" **this simplifies your Find statement Do Until adoMembers.Recordset.EOF = True adoMembers.recordset.Find "[Membership Number] = ' " & searchvar & " ' " Loop I put spaces between the ' and " for visibility..take them out hope that helps
tmcpolin at Yahoo! Answers Visit the source
Related Q & A:
- Can someone tell me how to put a backround for my psp and put pictures in it?Best solution by Yahoo! Answers
- Can anyone tell me how to select a University in Aus or NZ to study MA or MS or MBA in Communication?Best solution by Yahoo! Answers
- Can anyone tell me how to get rid of cellulite?Best solution by Yahoo! Answers
- Can someone tell me how to pick a lock?Best solution by wikihow.com
- Can anyone tell my how you can tell if your child has Apraxia of speech?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.