Command Button Opens blank record of seperate form with certain field pre-filled

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

Guest

I was wondering if anyone could help me out with this

I want to add a command button to a form "TenantsForm". The command button opens up a form "PaymentsForm" but automatically goes to a blank PaymentsForm with nothing but the "TenantID" field filled in. The TenantID should automatically match the TenantsForm TenantID

If I try to use the wizard, it only takes me to pre-filled forms or a completely blank form.

If anyone knows a workaround -- like adding a subform that always displays a new, blank record -- that'd work too.
 
Carnegie,

If it's a separate form, I think you could use code to assign the value
of the TenantID, for example the Click event procedure for the command
button might be like this...
DoCmd.OpenForm "PaymentsForm", , , , acFormAdd
Forms!PaymentsForm!TenantID = Me.TenantID

Another approach would be to set the Default Value property of the
TenantID control on the PaymentsForm form, to...
=[Forms]![TenantsForm]![TenantID]

And finally, as you suggested, a subform might be the simplest approach
of all. Just set the DataEntry property to Yes for the form you will
use as the suborm. Put it either directly on the TenantsForm form as a
subform, or maybe even better on a Tab Control, set the Link Master
Fields and Link Child Fields properties of the subform to TenantID, and
away you go.
 
If anyone knows a workaround -- like adding a subform that always displays a new, blank record -- that'd work too.

Add a Subform and set its Data Entry property to True.
 
Back
Top