Record match in Access_97

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
Can someone pls assist with VB code that will work in Access 97 as well.

I need to get a name in an input box, and then check whether that name appears in a specific field in a specific table (i.e. FamilyName within Emptable). I need to be able to find out how many exact matches there are (or if there is no match at all) for the name.

I'm working in Access 2002, but this needs to work in 97 as well.

Thanks.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
You can use the DCount function.

How about this:<pre>
Public Function GetNameCount() As Integer
Dim strName As String

strName = InputBox("Enter Name", "MyDB")
intEmp = DCount("[FamilyName]", "Emptable", "[FamilyName] like '*" & strName & "*'")

End Function</pre>

Then you can call this function something like this:<pre>
If GetNameCount > 0 Then
' It was found
End If</pre>
HTH,

Russell
This message was edited by Russell Hauf on 2002-12-08 18:21
 
Upvote 0

Forum statistics

Threads
1,221,490
Messages
6,160,133
Members
451,622
Latest member
xmrwnx89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top