473,397 Members | 1,961 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,397 software developers and data experts.

Find Record Command

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 replace but rather i would just like to have "find record"..ive read recent forums on the same question and decided to try a script that was posted in one of the forums...here is the script
Dim strFindID As String


strFindID = InputBox("Enter the ODSTL/Licensce_No:")


If IsNumeric(strFindID) Then
With Me.RecordsetClone
.FindFirst "[ODSTL/Licensce_No]=" & strFindID
If .NoMatch Then
MsgBox "Sorry, couldn't find that ID#."
Else
Me.Bookmark = .Bookmark
End If
End With
Else
MsgBox "Please enter a valid ID#!"
End If

I've added this script to the "find record" command button but it still doesnt work..the command button is designed to be in a form....please help.....
Jul 24 '07 #1
3 2803
ADezii
8,834 Expert 8TB
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 replace but rather i would just like to have "find record"..ive read recent forums on the same question and decided to try a script that was posted in one of the forums...here is the script
Dim strFindID As String


strFindID = InputBox("Enter the ODSTL/Licensce_No:")


If IsNumeric(strFindID) Then
With Me.RecordsetClone
.FindFirst "[ODSTL/Licensce_No]=" & strFindID
If .NoMatch Then
MsgBox "Sorry, couldn't find that ID#."
Else
Me.Bookmark = .Bookmark
End If
End With
Else
MsgBox "Please enter a valid ID#!"
End If

I've added this script to the "find record" command button but it still doesnt work..the command button is designed to be in a form....please help.....
You're dimensioning strFindID as a String but checking to see if it is Numeric - is ODSTL/Licensce_No a Number or String? If it is a String in a Numeric Format, then the Syntax is wrong.
Jul 24 '07 #2
You're dimensioning strFindID as a String but checking to see if it is Numeric - is ODSTL/Licensce_No a Number or String? If it is a String in a Numeric Format, then the Syntax is wrong.
ODSTL is a number....Each cutomer has a unique ODSTL number...It is labelled as such - Licensce_No - ODSTL 002/01..The Licensce_No is an attribute in the tale. Which syntax do i need to change??
Jul 24 '07 #3
ADezii
8,834 Expert 8TB
ODSTL is a number....Each cutomer has a unique ODSTL number...It is labelled as such - Licensce_No - ODSTL 002/01..The Licensce_No is an attribute in the tale. Which syntax do i need to change??
Assuming ODSTL/Licensce_No is the name of the Field in the underlying RecordSource of your Form, and you have already stated that it is Unique, then:
Expand|Select|Wrap|Line Numbers
  1. Dim varFindID As Variant
  2.  
  3. varFindID = InputBox("Enter the ODSTL/Licensce_No:")
  4.  
  5. If IsNumeric(varFindID) Then
  6.   With Me.RecordsetClone
  7.     '.FindFirst "[ODSTL/Licensce_No]=" & varFindID
  8.     If .NoMatch Then
  9.       MsgBox "Sorry, couldn't find that ID#."
  10.     Else
  11.       Me.Bookmark = .Bookmark
  12.     End If
  13.   End With
  14. ElseIf Len(CStr(varFindID)) = 0 Then
  15.   'User pressed Cancel or OK with no entry in Text Box, just let go
  16. Else     'if it gets to this point, something was entered but it wasn't a Number
  17.   MsgBox "Please enter a valid ID#!"
  18. End If
Jul 25 '07 #4

Sign in to post your reply or Sign up for a free account.

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...
3
by: Sarah Smith via AccessMonster.com | last post by:
I am creating a database of documents that need to be worked on, are int eh proress of being worked on, and have been completed. Sometimes the same document (an updated version) comes back for more...
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...
11
bhcob1
by: bhcob1 | last post by:
Hi, Whenever I delete a record my command button, the record deletes, a list displaying all records is updated and then a message box appears: Microsoft Access can't find the field 'I' referred to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.