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

Search Records in VBA

158 100+
I'm trying to search and display an record to a form using VBA Coding. here is what i have so far.

Expand|Select|Wrap|Line Numbers
  1. DoCmd. SearchForRecord acActiveDataObject, "tblIV", acFirst, patientID
  2.  
tblIV is the name of the table i want to search in, and patientID is an integer variable that i have a value given to it in a different form that is being passed to this form (i know for a fact that the value is being passed correctly).
May 19 '08 #1
4 11585
ADezii
8,834 Expert 8TB
I'm trying to search and display an record to a form using VBA Coding. here is what i have so far.

Expand|Select|Wrap|Line Numbers
  1. DoCmd. SearchForRecord acActiveDataObject, "tblIV", acFirst, patientID
  2.  
tblIV is the name of the table i want to search in, and patientID is an integer variable that i have a value given to it in a different form that is being passed to this form (i know for a fact that the value is being passed correctly).
You should definately benefit from reading this previous Tip of the Week:
How to Find a Record Programmatically
May 20 '08 #2
Jollywg
158 100+
Thanks worked like a charm!
May 20 '08 #3
NeoPa
32,556 Expert Mod 16PB
Have you considered simply applying a filter to the form that only allows the record you want?
May 21 '08 #4
missinglinq
3,532 Expert 2GB
This is a new command only appearing in Access 2007. It's always a good idea to include the version number when posting questions, but it's especially important when you're using this latest version, as many things are different in it and only a small subset of the members here are running it.

As for the command you're using, the code you posted has a space between DoCmd. and SearchForRecord, which it shouldn't, and you really haven't stated what problem, if any, you're experiencing, which you really should always do.

Although, as recently documented here on bytes, NeoPa's ESP is on fritz, his advice is well worth taking.

Linq ;0)>
May 21 '08 #5

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

Similar topics

2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
1
by: arikatla | last post by:
We are using SQL Server 2000 database (with sp3) and recently we faced an interesting issue with full text search. According to SQLServer help page "AND | AND NOT | OR Specifies a logical...
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
7
by: John | last post by:
hi, i have created a search form, and i want to search for a specific item in a field. e.g. i have a field called colour, which has record1 = 'red, blue, green' and another record2 = 'red' ...
2
by: Arsalan Ahmad | last post by:
Hi, May be I am a newbie, or may be i dont have that much insight in following systems ..i.e. why i have some confusions as below: In many websites, when search is performed on some keywords...
0
by: dio_mack | last post by:
MINIMIZE RISK BY CONFIRMING IDENTITY OF INDIVIDUALS Obtain the confidence you need to move forward quickly and accurately in business, institutional and personal matters with a full-spectrum check-...
3
by: vonclausowitz | last post by:
Hi All, I was thinking of creating a table in my database to index all words in the database. That way I can quickly search for one or more words and the index table will return the words and...
3
by: suek | last post by:
I have a table with over 4000 records to search upon, and the users don't like a combo box. So what I have been trying to do for the last twelve hours is do some code to get a text box to search. ...
3
by: Redbeard | last post by:
Hi All this is my first time post, be gentle. I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form...
13
by: jfarthing | last post by:
Hi everyone! I am using the script below to search a db. If the is more than one match in the db, all goes well. But if there is only one match in the db, nothing gets displayed. Any...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...

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.