By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,489 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,489 IT Pros & Developers. It's quick & easy.

Dynamic MS Access Form Help

P: 2
Hi all,

I am working with two forms. For simplicity, I will call them Form A and Form B. On Form A I have a command button that opens Form B. What I want to set up is when Form B is opened through Form A, an "ID" Field in Form B will become populated with the ID number currently being displayed in Form A. My question is, how do I set that up? Does MS Access have the built-in functionality for that, or do I need to code this myself?

Thanks in advance :) ,
hazy
Mar 2 '06 #1
Share this Question
Share on Google+
3 Replies


100+
P: 135
Set up a Public Variable in form B's general section and from form A's click event pass the ID to that variable.

Hi all,

I am working with two forms. For simplicity, I will call them Form A and Form B. On Form A I have a command button that opens Form B. What I want to set up is when Form B is opened through Form A, an "ID" Field in Form B will become populated with the ID number currently being displayed in Form A. My question is, how do I set that up? Does MS Access have the built-in functionality for that, or do I need to code this myself?

Thanks in advance :) ,
hazy
Mar 29 '06 #2

P: 2
Hi. Access has functionality for this.

Open form B using DoCMD.OpenForm method; you need to specify the FormName you want to open (in this case B). You are also able to pass the window view, mode, filters etc; however the option you want is OpenArgs. Set this value to the ID number shown on form A and within Form_load() on form B use Me.OpenArgs to capture the value. Set it to a private variable on FormB.

This is a much better way than having unecessary public variables on the forms, form Variables should really always be private, specify GLOBAL variables in a module.
May 4 '06 #3

P: 70
FormB_Load()

field1.value = forms!formA.fieldname

This will put the value from FormA into the field on FormB
May 4 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.