Using a button to fill in a form

  • Thread starter Thread starter afinley
  • Start date Start date
A

afinley

I am designing a new db system for the non-profit i work for. I cannot
build a totally new system, merely add onto the old one, and here is
what I have:

Two tables that are updated via one form each. In have one form, with a
subform that that is for a third table, I would like to add a button
that will fill in the second form with the information from the first.

We collect data on income as well as the SS# of the clients in an
updating file, then generate a new record for each time they receive
services. The service record merely has the date of service, the SS# of
the client, and a series of check boxes for which service they receive.

I would like to make a button on the first form that would just fill in
the table of the second form with the =Date(), the client's SS# off the
first form, and a check box filled based on which button is pressed.

Is this impossibly hard?
 
I am designing a new db system for the non-profit i work for. I cannot
build a totally new system, merely add onto the old one, and here is
what I have:

Two tables that are updated via one form each. In have one form, with a
subform that that is for a third table, I would like to add a button
that will fill in the second form with the information from the first.

We collect data on income as well as the SS# of the clients in an
updating file, then generate a new record for each time they receive
services. The service record merely has the date of service, the SS# of
the client, and a series of check boxes for which service they receive.

I would like to make a button on the first form that would just fill in
the table of the second form with the =Date(), the client's SS# off the
first form, and a check box filled based on which button is pressed.

Is this impossibly hard?


Not Hard.
Assuming your forms are: FormA & FormB and both forms are loaded and
you have a field on each form, "SSN"; you can create an On Click event
for a button on FormA:

Private Sub Command0_Click()

Forms!FormB!SSN = SSN 'This will copy the SSN from FormA to FormB
'...Use the same format to add any other action you want to take
'when button is clicked.

End Sub
----------------------

Form B must be loaded or this will give you an error. If you ever
have only Form A loaded, you can prevent error by adding an If Loaded
condition:

Private Sub Command0_Click()

If CurrentProject.AllForms!FormB.IsLoaded Then
Forms!FormB!SSN = SSN
'...Any other action you want to take when button is clicked.
End If

End Sub

-------------
 

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