Search : in
By :

Return Records Equal not Like in VBA

Last answer on Aug 24, 2009 2:17:32 pm BST Andy, on Aug 24, 2009 1:21:46 pm BST 
 Report this message to moderators

Hello,
I have created a database for tracking cell phones and everything was working great until my records got over 110. Now when I bring up record 112 and run the following script I get the information for both record 112 and 12! I think it's the "Like" condition in the last line of code but I have tried to replace it with "=" and that doesn't work. What can I do to fix this? This code is runing as the function of a button when the button is pressed it prints all the information for the selected custodian to the HReceipt form.

Private Sub HReceipt_Click()

'User must select a value from the combo box
If IsNull(CustodianID) = True Then
MsgBox "You must select a keyword."

'Open report called HReceipt where the PartsReplaced field
' contains the value in the hrcustodian combo box
Else
DoCmd.OpenReport "HReceipt", acViewPreview, , "ID Like '*" & ID & "*'"
End If

End Sub


Thank you!

Configuration: Windows XP Internet Explorer 7.0

Best answers for « Return Records Equal not Like in VBA » in :
Download Free Sound Recorder Show Free Sound Recorder makes exactly that his name says. He allows to record all sounds which take out sound from your card free. Files can be directly exported in format MP3, WAV or WMA. Free Sound Recorder is the ideal tool to record your own voice...
Mix your favourite music like a true DJ! ShowMix your favourite music like a true DJ! Atomix Virtual DJ DJ MIX You are fond of dj'ing... mix tracks and add effects... Atomix Virtual DJ Virtual Dj by atomix is the most well known software for mixing music, adding effects...
[VBA] Deleting a word in a range of cell Show[VBA] Deleting a word in a range of cell In the case you want to delete a word in a sentence, just create a small macro that removes the word. But it will become difficult when you have word like, for example, "Theword" or "THEWORD" or...
[VBA] A function that returns the color of an active MFC Show[VBA] A function that returns the color of an active MFC This function returns the value of the active format in conditional formatting. With the function below, two values can be returned. Mode = 0: the value of Interior.ColorIndex...
Download Cool Edit Pro ShowCool Edit Pro is a program to record, mix, edit, you can add special effects in your mix. It will be very useful for generating digital audio like a pro. Advantage You will have access to a full burn to edit files sized up to 2GB. Cool Edit Pro...
Download Cool Record Edit Pro ShowDescription The application is designed by CoolMedia, LLC. Simple and easy to use, Cool Record Edit Pro is a tool that enables you to record any sound being played on an external program. The application has been awarded from various places. It...
Network topology ShowWhat does "topology" mean? A computer network is made of computers which are linked to one another with communication lines (network cables, etc.) and hardware elements (network adapters, as well as other equipment for ensuring that data travels...
Network equipment - The switch ShowSwitches A switch is a multi-port bridge, meaning that it is an active element working on layer 2 of the OSI model. The switch analyses the frames coming in on its entry ports and filters the data in order to focus solely on the right ports (this...
Network equipment - Router ShowRouter A router is a device for connecting computer networks to one another, used for handling the routing of packets between two networks, or to determine the path that a data packet shall take. When a user enters a URL, the Web client (the...

1

 Andy, on Aug 24, 2009 2:17:32 pm BST

Thanks, I found the answer myself it was just a matter of putting in the right syntax. The line needed to be this:

DoCmd.OpenReport "HReceipt", acViewPreview, , "ID=" & ID

Now it works!

Reply to Andy