473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Find Record Help

I just want to say thank you to everyone that has help me with my
database. Could someone please take a look at this code and tell me
what it is I'm doing wrong. I have a find command button on my form
that I'm trying to use to and find a record. When I click Find on my
form, I want to find the record using ProjectID and Jurisdiction. I've
read other people answer and tried different code but nothing is
working. This is what I have so far.

Private Sub cmdFind_Click()
Dim rst As DAO.Recordset
Dim strSearchprojectid, strSearchState As String

Set rst = Me.RecordsetClone
strSearchprojectid = Str(Me!cboProjectID)
strSearchState = Str(Me!cboJurisdiction)
rst.FindFirst "cboProjectID = '" & strSearchprojectid & "'" &
"cboJurisdiction ='" & strSearchState
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close

End Sub
Thanks in advance for all your help.

Nov 13 '05 #1
2 1267
Step 1. Create an unbound texbox and name it: txtFilter (the label it
self can be named anything)

Step2. Create a command button on the form then hit cancel when the
wizard opens. Now go to properties and for caption name it: Filter and
for the name: Find Record
Now go to Event and in the On Click select event procedures now click
the ... to build.
Paste the following code in between the Private Sub and End Sub
(Field1, 2, 3 represent the field you want to query for add as many as
you need)

On Error GoTo Err_Find_record_Click

Me.Filter = "Field1 Like '*" & Me!txtFilter & "*' OR " & _
"Field2 Like '" & Me!txtFilter & "*'" & " OR " & _
"Field3 Like '*" & Me!txtFilter & "*'"
Me.FilterOn = True

Exit_Find_record_Click:
Exit Sub

Err_Find_record_Click:
MsgBox Err.Description
Resume Exit_Find_record_Click

Step3. Create another command button using the same steps as above but
name this one for Caption and Name: Remove Filter

In the event procedure paste the following code:
On Error GoTo tagError

Me.Filter = ""
Me.FilterOn = False
Exit Sub

tagError:
MsgBox Err.Description
Exit Sub

Please let me know if this works, I'm new at giving advice (still
receive it of course).

Nov 13 '05 #2
Thank you dmkei for your help. The instruction you gave does not find
the record. It does ask me to enter all three field but never filter
that specific record out.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: JIMMIE WHITAKER | last post by:
Can someone help on this: I am just learning, and I'm connecting to the the northwindcs.mdf tables / open file is northwindcs.adp. This is the sample installed using msde, which is supposed to be...
3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
10
by: Andrei Ivanov | last post by:
Hello, it seems my postgresql data has somehow become corrupted (by a forced shutdown I think): psql template1 -U shadow Password: ERROR: nodeRead: did not find '}' at end of plan node...
8
by: jquest | last post by:
Hi Again; I have had help from this group before and want to thank everyone, especially PCDatasheet. My database includes a field called HomePhone, it uses the (xxx)xxx-xxx format to include...
3
by: Randy | last post by:
I have been able to set up a Find Record Button on my switchboard to take me to a form with the correct case number by using a parameter query and macro. When I try to run the Find Record button...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
7
by: gjoneshtfc | last post by:
Hello I want to search my database for a vehicle registration number but before i can search using the Find Record button i created i have to click in the registration field so that it is that...
3
by: betterdayz | last post by:
hi...im trying to design the "find record" command whereby the user enters an ID Number and than clicks ok and the database does a search for that particular ID...the wizard command uses find and...
3
by: Jiwei06xie | last post by:
Dear Experts, As I am a beginner of Access 2000, could I ask for some help regarding the following situation? I have two tables called tblDelivery and tblStock, both having a text field...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.