Need help with query on a form

G

Guest

I am really new to access and VB so I really could use some help on this one.
I have a simple database that keeps track of transations for a small group of
employees. I want to create a form that will contain the following.
1.) A text box at the top where I can enter the number of a PO.
2.) A button next to the "po" text box that will query only the transations
of the PO number I entered into the text box.
3.) At the bottom of the form I would like to have about ten fields be
populated with the information about this transations. This information was
first entered in another form in the database by the employee. I just need to
be able to double-check their work and make changes to the information if it
is need or something is missing. I don't if I would need a subform for this
or if it could just be on the same form as the text box.

Thank you very much for any help on this.
Paul
 
S

SteveS

Here is one approach...

Create a new form. Set the Default View to 'Continuous forms'. Set 'Allow
Additions' and 'Allow Deletions' to NO.

Make sure you can see the FORM header/footer. In the header add an unbound text
box control - name the control something like tbPO_Number. Add a button.

Set the 'Record Source' to a query that has the fields you want to see. In the
query, set the criteria for the PO column to

Forms!frmName.tbPO_Number

(change frmName to the name of your form)

In the detail section of the form, add the fields you want to see.

In the OnClick event of the button, add the lines:

Me.Requery
' if you want the text box to be cleared, uncomment the next line
'Me.tbPO_Number = Null

The form will open with no records in the detail section. Type in a PO number
and click the button. If there are any PO numbers that match, they will be
displayed.


WARNING: any changes you make are made immediately.

You could set the Locked property to YES for each of the controls and add a
button (EDIT) that would set the Locked property to NO when you wanted to make
changes. In the Form OnCurrent event you should set the Locked property back to YES.


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top