473,803 Members | 3,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find record - Simple problem

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 which
will find that record. That will be the ideal solution but I do not
know enough VB to program the button. Can anyone help with that?

Thanks for your time,
Regards, Gareth

Jun 27 '06 #1
7 9455
If you put a command button on your form, you can SetFocus to the
Registration field, and the call the Find dialog. The Event Procedure for
the Click of your button would be something like this:

Private Sub cmdFind_Click()
If Me.Dirty Then Me.Dirty = False
Me.[Registration].SetFocus
RunCommand acCmdFind
End Sub

An unbound text box at the top of your form makes a very nice interface for
jumping to a record. You can use the AfterUpdate event of the text box, so
you just press Enter and it finds it. The code for the Event Procedure to
use in the text box's AfterUpdate would be identical to this:
http://allenbrowne.com/ser-03.html
Although that article talks about a combo, it's the same code for the text
box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gj********@vol canomail.com> wrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...

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 which
will find that record. That will be the ideal solution but I do not
know enough VB to program the button. Can anyone help with that?

Thanks for your time,
Regards, Gareth

Jun 27 '06 #2
You can use a DLookup function behind your button, and it won't even
look at the registration field on your form. do something like:

X = InputBox("VIN")

Then do a DLookup in your table with the VINs and search for that value
of X.
gj********@volc anomail.com wrote:
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 which
will find that record. That will be the ideal solution but I do not
know enough VB to program the button. Can anyone help with that?

Thanks for your time,
Regards, Gareth


Jun 27 '06 #3
Thanks Allen... got the text box find thing working great now. Is there
a way to use a button though or can it only be done by pressing enter?

Thanks again,
Gareth
Allen Browne wrote:
If you put a command button on your form, you can SetFocus to the
Registration field, and the call the Find dialog. The Event Procedure for
the Click of your button would be something like this:

Private Sub cmdFind_Click()
If Me.Dirty Then Me.Dirty = False
Me.[Registration].SetFocus
RunCommand acCmdFind
End Sub

An unbound text box at the top of your form makes a very nice interface for
jumping to a record. You can use the AfterUpdate event of the text box, so
you just press Enter and it finds it. The code for the Event Procedure to
use in the text box's AfterUpdate would be identical to this:
http://allenbrowne.com/ser-03.html
Although that article talks about a combo, it's the same code for the text
box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gj********@vol canomail.com> wrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...

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 which
will find that record. That will be the ideal solution but I do not
know enough VB to program the button. Can anyone help with that?

Thanks for your time,
Regards, Gareth


Jun 27 '06 #4
Add a command button, and move the code into the event procedure for the
Click of the button.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gj********@vol canomail.com> wrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
Thanks Allen... got the text box find thing working great now. Is there
a way to use a button though or can it only be done by pressing enter?

Thanks again,
Gareth
Allen Browne wrote:
If you put a command button on your form, you can SetFocus to the
Registration field, and the call the Find dialog. The Event Procedure for
the Click of your button would be something like this:

Private Sub cmdFind_Click()
If Me.Dirty Then Me.Dirty = False
Me.[Registration].SetFocus
RunCommand acCmdFind
End Sub

An unbound text box at the top of your form makes a very nice interface
for
jumping to a record. You can use the AfterUpdate event of the text box,
so
you just press Enter and it finds it. The code for the Event Procedure to
use in the text box's AfterUpdate would be identical to this:
http://allenbrowne.com/ser-03.html
Although that article talks about a combo, it's the same code for the
text
box.

<gj********@vol canomail.com> wrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...
>
> 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 which
> will find that record. That will be the ideal solution but I do not
> know enough VB to program the button. Can anyone help with that?
>
> Thanks for your time,
> Regards, Gareth

Jun 27 '06 #5
Thanks, but will the code not change so that it references the text box
in some way? That was the bit i was unsure off?

Thanks again,
Gareth
Allen Browne wrote:
Add a command button, and move the code into the event procedure for the
Click of the button.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gj********@vol canomail.com> wrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
Thanks Allen... got the text box find thing working great now. Is there
a way to use a button though or can it only be done by pressing enter?

Thanks again,
Gareth
Allen Browne wrote:
If you put a command button on your form, you can SetFocus to the
Registration field, and the call the Find dialog. The Event Procedure for
the Click of your button would be something like this:

Private Sub cmdFind_Click()
If Me.Dirty Then Me.Dirty = False
Me.[Registration].SetFocus
RunCommand acCmdFind
End Sub

An unbound text box at the top of your form makes a very nice interface
for
jumping to a record. You can use the AfterUpdate event of the text box,
so
you just press Enter and it finds it. The code for the Event Procedure to
use in the text box's AfterUpdate would be identical to this:
http://allenbrowne.com/ser-03.html
Although that article talks about a combo, it's the same code for the
text
box.

<gj********@vol canomail.com> wrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...
>
> 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 which
> will find that record. That will be the ideal solution but I do not
> know enough VB to program the button. Can anyone help with that?
>
> Thanks for your time,
> Regards, Gareth


Jun 27 '06 #6
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in
news:44******** **************@ per-qv1-newsreader-01.iinet.net.au :
Add a command button, and move the code into the event procedure
for the Click of the button.


Better still, add the command button with no code behind it and
leave the textbox alone. If the user clicks the command button
(which does nothing), it causes the focus to leave the textbox, thus
forcing the AfterUpdate event to fire. You then also get the benefit
for the user who is smart enough to know to hit ENTER.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 27 '06 #7
The code from the link would be the same.

David's suggestion would also work.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gj********@vol canomail.com> wrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
Thanks, but will the code not change so that it references the text box
in some way? That was the bit i was unsure off?

Thanks again,
Gareth
Allen Browne wrote:
Add a command button, and move the code into the event procedure for the
Click of the button.

<gj********@vol canomail.com> wrote in message
news:11******** **************@ 75g2000cwc.goog legroups.com...
> Thanks Allen... got the text box find thing working great now. Is there
> a way to use a button though or can it only be done by pressing enter?
>
> Thanks again,
> Gareth
>
>
> Allen Browne wrote:
>> If you put a command button on your form, you can SetFocus to the
>> Registration field, and the call the Find dialog. The Event Procedure
>> for
>> the Click of your button would be something like this:
>>
>> Private Sub cmdFind_Click()
>> If Me.Dirty Then Me.Dirty = False
>> Me.[Registration].SetFocus
>> RunCommand acCmdFind
>> End Sub
>>
>> An unbound text box at the top of your form makes a very nice
>> interface
>> for
>> jumping to a record. You can use the AfterUpdate event of the text
>> box,
>> so
>> you just press Enter and it finds it. The code for the Event Procedure
>> to
>> use in the text box's AfterUpdate would be identical to this:
>> http://allenbrowne.com/ser-03.html
>> Although that article talks about a combo, it's the same code for the
>> text
>> box.
>>
>> <gj********@vol canomail.com> wrote in message
>> news:11******** *************@j 72g2000cwa.goog legroups.com...
>> >
>> > 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
>> > which
>> > will find that record. That will be the ideal solution but I do not
>> > know enough VB to program the button. Can anyone help with that?
>> >
>> > Thanks for your time,
>> > Regards, Gareth

Jun 28 '06 #8

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

Similar topics

4
5130
by: Gleep | last post by:
Hey Guys, I've got a table called Outcomes. With 3 columns and 15 rows 1st col 2nd col 3rdcol outcome date price There are 15 rows for each record, each row accounts for a different type of outcome I'm having trouble with MySQL date comparison. I'm looking for some kind of query that will compare the all date column and only give me the latest date. Then once I have it, ...
3
7885
by: Jonathan | last post by:
Hi all! For a match schedule I would like to find all possible combinations of teams playing home and away (without teams playing to themselves of course). I now the simple version works something like this: For a (very) simple table containing three rows like this: row 1: A
2
14941
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data in the format that I need it in order to create the reports that we use. So far this has proven to be successful for the reports that I am doing and the data that I am pulling into it. I just have one challenge that may require a lot of work and I...
6
10100
by: Kifah Abbad | last post by:
hi guys, First thanks for the support in my last question posted here. Now i have been trying today to read about finding a way to solve this (simple?) problem....which is...i have a string lets say "Leila" from user and i want to search a text file with a table of values "name of girl" "hair color", so like this somehow:
5
2117
by: hontai | last post by:
I've run into something that seems like a glitch, because the code and the test database are so simple that I can't fathom what could be wrong. I'm running a simple update query on a mySQL database, using PHP version 4.4.2 and mySQL 4.1.21-standard (my web host's, not my own): $resetkey = (...some randomized string...); $query = "UPDATE weblogins SET veristring='".$resetkey."' WHERE email='".$_POST."'"; $result = mysql_query($query) or...
6
6997
by: nickvans | last post by:
Hi all, I have a table called tblRecords that has "DashNum" as its primary key. The lowest value of this table is 116 and the highest value is 269, though there are some missing values. It is expected that records will be removed in the future, leaving more missing values. I would like to have a text box have as its default value the first unused entry in this table. I found a way to do this, but its not very efficient and requires an...
14
3825
by: lee | last post by:
hi, i have a dictionary as follows : kev : {'phno': , 'email': , 'name': , 'address': } if user is enters the 3rd item of key phno, ie "dfsdf" in my dict, how can i find it is the third item in the internal list of phno of that dictionary? thanks you.
3
1517
by: Payne | last post by:
Hello, I'm having trouble figuring out how to best explain my problem but I hope I can make myself clear enough. Anyway, I'm doing an assignment for school and in this one we're supposed to write a simple "database" class. The interface of this database class supports adding items, removing items, obtaining information about how many items are stored etc. In the assignment the database is supposed to support only storing items of a...
7
1815
by: redman08 | last post by:
I have a problem as follows:I have a form, with fields to edit. The data is keyed on a 'text identifier', which is entered and then used. I then determine if there are multiple occurrences of the that key (it's annoying, but possible).The single occurrence of the 'text identifier' is no problem - at the moment. If there are multiple occurrences, I use a combo to select which date the user wants. I then try and select the correct record using...
0
9700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10546
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, 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...
1
10292
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,...
0
9121
agi2029
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...
0
6841
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();...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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
3
2970
bsmnconsultancy
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...

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.