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

How to add a search field that will go directly to the record entered?

I have a form with ID, Name, Class and several Scores.
I want to be able to enter the ID and that record comes up so that I can just use tab to enter the scores.
Example: 1024 tab 3 tab 4 tab 3 tab 6 tab 9 tab tab
by entering 1024 I would go to that record and be able to start entering the scores. the last tab would take me back to the ID field for the next record source.
The plan is to never have to use the mouse (in the search at the bottom of the screen).
I figure I will need VBA code OnUpdate or OnEnter to goto the record entered.
Aug 5 '10 #1

✓ answered by Steven Kogan

The control wizard for a new combo box has an option to find a record based on what you select.

Click the combo box control, then click on your form, and if you have the wizards enabled it will prompt you on what to do.

A sample of the code generated is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo6_AfterUpdate()
  2.     ' Find the record that matches the control.
  3.     Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[ID] = " & Str(Nz(Me![Combo6], 0))
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  
  10.  

6 1542
Steven Kogan
107 Expert 100+
The control wizard for a new combo box has an option to find a record based on what you select.

Click the combo box control, then click on your form, and if you have the wizards enabled it will prompt you on what to do.

A sample of the code generated is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo6_AfterUpdate()
  2.     ' Find the record that matches the control.
  3.     Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[ID] = " & Str(Nz(Me![Combo6], 0))
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  
  10.  
Aug 5 '10 #2
That works great! I added the following so that it would auto advance and clear the search field for the next search:

Expand|Select|Wrap|Line Numbers
  1.     Me![Score1].SetFocus
  2.     Me![SearchID].Value = Null
I'm so new that I haven't used the control wizard (didn't know about it).
Aug 5 '10 #3
Steven Kogan
107 Expert 100+
Are you setting the combo box value to null? Or your ID field value to null (which would erase your data)?

I'm surprised your combo box name would be ID.
Aug 5 '10 #4
I edited the pasted info so it would be understandable.
The combo box is [searchid]. I just fixed it in my last post.
Aug 5 '10 #5
Steven Kogan
107 Expert 100+
To avoid going to a new record after the last tab, set the 'Cycle' property, on the 'Other' tab of your Form properties to 'Current Record'.
Aug 5 '10 #6
That's cool! So much to learn in too little time. Sorry to be such a schmuck. I have to finnish this project by Saturday for a contest.
Aug 5 '10 #7

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

Similar topics

5
by: Rose | last post by:
I want to use the javascript dom to reference the field of a record in a multi-record html form when that field has been changed. How do I reference the field? I have a JavaScript function coded...
1
by: Mario | last post by:
I am trying to set up a search field that searches my only my website. I dont want to link it to other search engines. It is only for the web im developing. Any Links or Suggestions on how to...
4
by: Chuck | last post by:
I'm attempting to build a module that will allow me to update one field of a record (using a value from a previous record) based on the value of another field in the same record. I can...
4
by: Captain Wonky | last post by:
As the subject says... I'm a database novice even though I've been trying to learn Access for years. I've 'almost finished' several databases but always get stumped on something - this time it's...
2
by: AA Arens | last post by:
When I push on my find-record button, after I focussed on the ID-number field on my form, the default search field in the Search-form dialog menu is not the focussed field, but another. Why? ...
3
by: larry | last post by:
Hi, Is there a way to calculate the sum of the numbers in each field for each record in the recordset returned from the query? Do I have to use VBScript? Thanks, Larry
31
by: MRHIGHSPEED | last post by:
Hi all. I'm new here and fairly new to building databases. Learned a lot in designing this one, but I am stuck on this one last expression. I'm trying to create a calculated control. The form is...
8
by: ivijayan | last post by:
HI. I have the following query:- How do i create field which updates its contents on the basis of data in another field in same record. especially if I have a Date field, how can I change the...
11
by: eimbert | last post by:
Hi, Im fairly new in the Access world. I would like to know how I can prevent users from changing data entered into a specific field of a record. Once I have completed the data Entry they should be...
1
by: brenty66 | last post by:
I have a userform that is used as an interface for information stored on excel spreadsheets. The user enters bits of information into fields on the userform which are place on the corresponding...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.