473,395 Members | 2,253 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,395 software developers and data experts.

search function problem

11
So I have a search form called ‘fdlgSearchPatient’
It is a search-as-you-type function. The function works fine so far.


Now I added EDIT and ADD NEW button but I don’t know how to link it.
I would like the FrmAuditTool to be pulled up when the user hit EDIT and frmNEW when the user hit ADD NEW button.

How do I make this work? The search as you type codes were simply copied from an online example.


The reason I have two forms is because ADD NEW would take the user to NEW FORM.. whereas EDIT will take the user to the saved record.


Please see the attached file for what I have created so far.
Thanks!
Attached Files
File Type: zip access SEARCH.zip (182.1 KB, 75 views)
Jan 5 '12 #1

✓ answered by Seth Schrock

Well, the database doesn't help much as most of the design feature have been disabled somehow. Anyway, for the Add New button, enter the following in the On Click event:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmNEW"
  2. DoCmd.GoToRecord , , acNewRed
For the Edit button, I'm not sure what you have as the primary key for the records. I'm going to guess VisitID. If I'm correct, then you would add the following in the EDIT button's On Click event:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FrmAuditTool", , , "VisitID=" & VisitID
The part at the end of this code where is says
Expand|Select|Wrap|Line Numbers
  1. "VisitID=" & VisitID
works like this... The VisitID in the double quotes ("") is the name of the primary key field in the table supporting FrmAuditTool and the second VisitID (after the &) is the name of the control on fdlgSearchPatient that contains the Primary Key value. Keep in mind that I'm only guessing that the VisitID is the primary key field. If I'm wrong, then you will need to update that end code to make sure that it references the correct field or it won't work.

3 1303
Seth Schrock
2,965 Expert 2GB
Well, the database doesn't help much as most of the design feature have been disabled somehow. Anyway, for the Add New button, enter the following in the On Click event:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmNEW"
  2. DoCmd.GoToRecord , , acNewRed
For the Edit button, I'm not sure what you have as the primary key for the records. I'm going to guess VisitID. If I'm correct, then you would add the following in the EDIT button's On Click event:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FrmAuditTool", , , "VisitID=" & VisitID
The part at the end of this code where is says
Expand|Select|Wrap|Line Numbers
  1. "VisitID=" & VisitID
works like this... The VisitID in the double quotes ("") is the name of the primary key field in the table supporting FrmAuditTool and the second VisitID (after the &) is the name of the control on fdlgSearchPatient that contains the Primary Key value. Keep in mind that I'm only guessing that the VisitID is the primary key field. If I'm wrong, then you will need to update that end code to make sure that it references the correct field or it won't work.
Jan 6 '12 #2
sk88
11
Thank you so much, Seth! :)
Jan 6 '12 #3
Seth Schrock
2,965 Expert 2GB
Not a problem. Glad to help.
Jan 6 '12 #4

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

Similar topics

3
by: Andy Jacobs | last post by:
Hi all I have a search function on a site of mine. At the moment, the content is delivered using this: <?php echo $row_Recordset1; ?> The search function goes through the table and...
2
by: gyromagnetic | last post by:
Hi, I have written a function that searches a text string for various words. The text is searched using a boolean 'and' or a boolean 'or' of the input list of search terms. Since I need to use...
5
by: James Stroud | last post by:
Hello All, I'm using pyinstaller 1.0 (stable) on win32xp and it is not able to find the codec for several encodings (hex, base64, etc.). I resorted to writing my own for hex, just to see if I...
3
markmcgookin
by: markmcgookin | last post by:
Hi Folks, I have a VB app, and I have been working at it for a while, and I am now at the stage where I want to create a search function. Now don't be scared! It is in the .Net compact framework,...
3
by: alexmason86 | last post by:
getting a bit stuck here got some code that allows a user to input numbers to a 3x3 array. but next on the tutorial sheet i have to then ask the user for a number to search for and then search the...
0
by: kang jia | last post by:
hi currently i am doing this search function for car booking website. it can search through either car seats or CarModel. it seems it able to do search function, however i small problem occurs to...
1
by: ashraf02 | last post by:
Someone please help! i am writing a code for a search function and everytime i execute the code i get the following error. You have an error in your SQL syntax; check the manual that corresponds...
1
by: nik707 | last post by:
Hello all, I would like to develop a date search from Form in Access. Here is the sample of previous search coding I have developed used the help of experts on this forum. 'Approach to CSR...
1
by: David De | last post by:
Need help with my site - search function within my site not working?!? I purchased this template, customized it and found out it has a search function for within the site - the challenge is that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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,...

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.