carrying data from one form to another

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

Guest

I have two tables 'JobsT' and 'NotesT' and a query called 'JobsQ'. I also
have two forms called 'JobsF' and 'NotesF'.

The source for 'JobsF' is 'JobsQ' which contains all the information that is
in the table accept it initially asks for a job number to filter all but one
job. When the jobs form is opened and we filter to one job, the form shows
all the details of that job.

On the jobs form I need a button that opens the notes form on a new record
with the job number been the same as that on the jobs form. It needs to copy
the job number from the job number field on the jobs form to the job number
field on the notes form.

I also need a button that opens a note query and automatically filters the
notes using the job number from the jobs form.


Please help

Regards

Christopher Buxton
 
1.
Pass the [job number] field using the OpenArgs, in the Open form command line

DoCmd.OpenForm "NotesF", , , ,AcFormAdd , ,Me.[job number]

On the OnLoad event of the NotesF, you can assign the OpenArgs to the
fields

If Not Isnull(Me.OpenArgs) And Me.OpenArgs <> "" Then
Me.[job number] = Me.OpenArgs
End If
=============================
2.
In the query create a filter that refer to the fileld in the form

Select * From NotesT Where [job number] = Forms![JobsF]![job number]

On the onclick event run this query
Docmd.OpenQuery "QueryName"
================================
Note, that you might need to change the name of the [job number] to the name
you have
 

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

Back
Top