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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

prefilling controls on a form



 
 
Thread Tools Display Modes
  #1  
Old May 6th, 2004, 01:10 AM
Nathan Sanders
external usenet poster
 
Posts: n/a
Default prefilling controls on a form

Hi

I have two forms FrmA and Frmb.

A command button on FrmA is used to open FrmB.

What code do I need to use to prefill controls on FrmB with values from
FrmA?

Thanks
Nathan


  #2  
Old May 6th, 2004, 02:38 AM
Terry
external usenet poster
 
Posts: n/a
Default prefilling controls on a form

Nathan,

You can use the default value property:
In your control(s) on FrmB use =[forms]![frmA].
[controlname] put this into the default value in the
properties. The assumption here is that FrmA is still open
and populated.

HTH,

Terry

-----Original Message-----
Hi

I have two forms FrmA and Frmb.

A command button on FrmA is used to open FrmB.

What code do I need to use to prefill controls on FrmB

with values from
FrmA?

Thanks
Nathan


.

  #3  
Old May 6th, 2004, 03:42 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default prefilling controls on a form

Nathan,

You have three options:

1. If FormB is bound to a table or query, the appending a WHERE clause to
the DoCmd.OpenForm method will populate FormB with the appropriate data. For
example:
DoCmd.OpenForm "FormB", , , "SomeField = somevalue"

2. You can push the values into FormB's controls using their fully-qualified
names. For example:
DoCmd.OpenForm "FormB"
With Forms!FormB
!txtSomeTextbox = "abc"
!txtAnotherTextbox = 2
End With

3. You can add some properties to FormB, instantiate it from FormA, and
populate the fields as you would any other object. See the following page
for an example of this:
http://www.pacificdb.com.au/MVP/Code/MyDialog.htm

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"Nathan Sanders" wrote in message
...
Hi

I have two forms FrmA and Frmb.

A command button on FrmA is used to open FrmB.

What code do I need to use to prefill controls on FrmB with values from
FrmA?

Thanks
Nathan




 




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 05:08 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.