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(strFi ndID) Then
With Me.RecordsetClo ne
.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.....
3 2847 ADezii 8,834
Recognized Expert Expert
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(strFi ndID) Then
With Me.RecordsetClo ne
.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.
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??
ADezii 8,834
Recognized Expert Expert
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: -
Dim varFindID As Variant
-
-
varFindID = InputBox("Enter the ODSTL/Licensce_No:")
-
-
If IsNumeric(varFindID) Then
-
With Me.RecordsetClone
-
'.FindFirst "[ODSTL/Licensce_No]=" & varFindID
-
If .NoMatch Then
-
MsgBox "Sorry, couldn't find that ID#."
-
Else
-
Me.Bookmark = .Bookmark
-
End If
-
End With
-
ElseIf Len(CStr(varFindID)) = 0 Then
-
'User pressed Cancel or OK with no entry in Text Box, just let go
-
Else 'if it gets to this point, something was entered but it wasn't a Number
-
MsgBox "Please enter a valid ID#!"
-
End If
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 mini sql
server to learn.
Please don't refer me elsewhere, here is what I'm trying to learn:
If I want to hit a command button and do the following:
1. Find a customerid
2. if found, edit the record, if not found, add a new record.
How would...
|
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 application that is going to be
used to extract data from a legacy system (VSAM based mainframe file
structure), and output data in pipe-delimited record layouts, multiple record
types per file, one file per chosen client. I have been working on...
|
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
Welcome to psql 7.3.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
|
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 work. I am keeping all the info in one table and using an Index numberas my Primary Key. I have a form based on this table with a Findrecord button (used the Command Button Wizard for this) that populates the form when it finds the particular record....
|
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 area code.
When a customer calls, I currently use Ctrl F with the HomePhone field
highlighted. Then I enter the last 4 digits and use the find next option.
This is cumbersome, so I have tried several methods (including a macro)
using comand...
| |
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 from the macro on the form I
want to find the record in it just sits there and does not run.
Could someone tell me how to fix this? Please be specific as I am new
to Access.
|
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, "Facilities").Position = iPos
That is the code.. dr is DataRow. If dr.Item("ID") = 3, the find will
return position 0, which it should have been 1, and if the ID = 2, it
will return 1, which should have been 0.. The DA has a connection string
that sorts it...
|
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 one that is being
searched. Is there any way to just click the button and by default it
searches the registration field?
Or... is there a way where I can get the user to type in the
registration number in a text field then click a command button...
|
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 in your expression
It only has the option of clicking 'OK', when I do this everything is fine again.
I would like to know what is going on and how to fix this problem. Below is parts of the code that I believe the problem is in.
The form is...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |