How to auto-populate some fields from the last record to the newon

F

fossy

I have a form: (frmTEST_CUT), that it is link to a main form: (frmMAIN), each
with its own table. frmMAIN keeps track of the jobs that run thru the company
and frmTEST_CUT is a test form for the job number; each job has more than 1
test.

The tbJOBS table, has a key field "Jobs", and the tbTEST_CUT has the same
field "Jobs" that links them together.

frmTEST_CUT is a subform inside frmMAIN, this helps by keeping all the
information of the job displayed and only changing the test results in the
inside window (subform). Is there a way to keep the testers name fron the
last test to the newone but only when they are from the same job number.

In other words: Auto-populate the "Tester_Name" field of the new test
(record) but only when the new record is the 2nd or later test of the job. It
would make it faster if the tester has to put his name only onces.

I wanted to put a drop down window but the tester most likely won't be the
same from one week to another... thanks in advance for your help. Saul DeLuna.
 
M

Marshall Barton

fossy said:
I have a form: (frmTEST_CUT), that it is link to a main form: (frmMAIN), each
with its own table. frmMAIN keeps track of the jobs that run thru the company
and frmTEST_CUT is a test form for the job number; each job has more than 1
test.

The tbJOBS table, has a key field "Jobs", and the tbTEST_CUT has the same
field "Jobs" that links them together.

frmTEST_CUT is a subform inside frmMAIN, this helps by keeping all the
information of the job displayed and only changing the test results in the
inside window (subform). Is there a way to keep the testers name fron the
last test to the newone but only when they are from the same job number.

In other words: Auto-populate the "Tester_Name" field of the new test
(record) but only when the new record is the 2nd or later test of the job. It
would make it faster if the tester has to put his name only onces.

I wanted to put a drop down window but the tester most likely won't be the
same from one week to another.


If the records are sorted by the test date field, then you
can use the form's Load event to set the tester combo box's
DefaultValue to the latest record's tester when the form is
opened:

With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
Me.thecombobox.DefaultValue = """" & !testerfield & """"
End If
End With

If a different tester comes along, the resrer will have to
use the combo box to change the tester field. When that
happens, you can use the combo box's AfterUpdate event to
(re)set the DefaultValue for the remainder of the time the
form remains open:

Me.thecombobox.DefaultValue = """" & Me.thecombobox & """"
 

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