Search record using text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I has been search through this forum an age but can not find the solution,
so please help me out.
I using Access2K, table personinfo have field p_id is a primary key.
1. I have created a search form name SearchRecord with 4 text fields:
PersonID, Lastname, Firstname, and Agency let the user type all information
in it.
2. When the user type in all information then click button "SEARCH" it will
search through table Personinfo for matching P_ID OR Lastname OR firstname OR
Agency and open the other form named "ViewRecord" with all record match these
criteria, then
3. the user highlight the record they want to open then click the button
"View" then a message pop up "Do you want to view this record?" If they click
Yes then it will open a form named "ViewRecord2" with all the information.
So, please advice.
Thank you.
 
Thank for reply,
I'm try to open the form "ViewRecord2" and let the users edit record they
found.
Regards,
MN
 
You should just be able to run

docmd.openform "ViewRecord2",,,"P_ID="+something

where 'something' is a reference to the record selected on SearchRecord.
What that reference is depends on how that search form is set up. Is it a
continuous form?... a listbox?... a subform? Post back if you can't figure
out how to get that reference.
 
Thank Rob for reply,
I did step 1 & 2.
In the form "ViewRecord" I using FormOpen() and load a query to browse the
record match criteria.
Now I am in the Form "ViewRecord" - Single Form - With a browse query window.
How can I select that P_ID in that browse window to built a OK button to
open a form "ViewRecord2" with the info in the browse window of form
"ViewRecord".
Sorry for too long explain.
Again Thanks for reply.
MN
 
You won't be able to do it that way. There's no way of referencing fields
simply displayed in a query window. There are a couple of ways of doing
it... I'd probably go for this one....

Create a new form, not bound to any data source.
Add a listbox to that... and set its rowsource to be your query. You'll
need to increase the columncount to see all your fields. Make sure that the
bound column is the one containing your IDs.
Add a button onto the form and then just run

docmd.openform "ViewRecord2",,,"P_ID="+lstBoxControlName

Any good?
 
Back
Top