Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To search for record by Serial Number

Status
Not open for further replies.

cnitadesigner

Programmer
Jan 2, 2002
12
US
I have 2 forms:
1) is a user input Text box
2) is the display of the record user inputs by Serial Number

So I bring uo the first form so the user can type in the Serial Number s/he wants to lookup/search on. When the user clicks the button, it should open up the second form where the focus is on the serial number user inputted.

Can anyone steer me in the right directions.
I have thought of several different methods/ways.
1) Recordset
2) RecordsetClone
3) Bookmark
4) OnFocus
5) FindRecord
6) Goto Record
7) Goto Control
 
see help on the openform() method

DoCmd.OpenForm formname[, view][, filtername][, wherecondition][, datamode][, windowmode][, openargs]

DoCmd.OpenForm "form2",,"serialNumber =" & forms!form1!textboxname


 
I used this command and the form still does not point to the correct record it just looks at the first record in the Form2.
 
braindead2
How about using a query to look up the serial number?
Try creating a query with all the fields that are on your 2nd form. in the serial number field in criteria use:
Like [enter serial number]
on your first form create a command button and use the 2nd form as record source.
when you click the button a box will appear asking for the serial number. Click ok and the record should appear with the info provided in the second form.
Jim
 
Hey this sounds like it will work.
I will attempt to carry it out.
Let me make sure I got this right:
Make a query that will have same fields as Form2.
Set Record Source to that query in Form2.
then allow user to enter serial number then it should
appear in second form.
 
First it gave an error message "Object required". I had some type of Redcordset still in there so I commented that out. So the second Form opens up perfectly but it still opens up at the 1st Record.
 
in the query don't forget to put the "like [serial num]" in the criteria... you have to activate the query with some method. I use command buttons.
Jim
 
I did that because it gave me a window to enter in the serial number but on my first form that's where I asked the user for the serial number. If I put it in the query that means I don't even need the first form. That's all the first form does is ask for user input. But if in the query there is criteria to prompt the user. Well let me try that just have one form and not the form1. Thanks I'll let you know how it goes.
 
cnitadesigner,
I should have said activate the form.
Do you use a switchboard?
If you do create a new button and set it to the form.
I started out on the original Access with out switchboard. I use forms with command buttons all over them to navigate and activate forms and underlying queries.
Jim
 
Actually I have a MainForm I created but I didn't use the Switchboard Wizard. My version sucks; it wasn't installed properly and now no one knows where the original software is to reinstall it. Anyway which form did you want me to activate?
I'm use to using Access 2.0 too but my main form doesn't activate form2 yet (i'm assuming that's the one to activate right?).
 
cnitadesigner,
If you made the query with the like[] and form2 is complete with the record source set to the query. Create a command button on your main form and make the record source the form, not the query.
When the "enter parameter value" box appears you can enter the entire serial # or just part of it and an *
Jim
 
This close __.
Well I did what you said by having the query be the record source for the form2. and form2 is completed. When I enter the parameter, the form opens in data entry form ready for a new record.
 
This is my code
DoCmd.OpenForm "eV_dataForm", acNormal, , , , acWindowNormal
attached to the form.
 
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you so much for your time and advice.
I kept tweaking the last thing you said to do and
it WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You;re not going to believe what I was doing wrong. Everything was in place but I didn't type in the first digits
of the Serial Number/Parameter and it didn't know what information I was talking about.

Thank You Jpeneh10
Now I can type in the serial number * or whole serial number and it WORKS!!!!!!!
It WORKS!!!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top