A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2004, 01:56 AM
Carnegie23
external usenet poster
 
Posts: n/a
Default Command Button Opens blank record of seperate form with certain field pre-filled

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.
  #2  
Old June 5th, 2004, 02:59 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default Command Button Opens blank record of seperate form with certainfield pre-filled

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.

--
Steve Schapel, Microsoft Access MVP

Carnegie23 wrote:
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.

  #3  
Old June 5th, 2004, 03:05 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Command Button Opens blank record of seperate form with certain field pre-filled

On Fri, 4 Jun 2004 17:56:03 -0700, "Carnegie23"
wrote:

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.


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.