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

Open a form to a specific record, based on a control on another form

P: 4
I have a form that is locked for editing, adding or deleting. Through the use of a command button I open another form, that allows editing, plus allows the user to other areas of the database, through command buttons.
When I click the command button I want to open the second form displaying the CompanyName and information from the first form (the record I had displayed on first form, but open for editing.
On the second form I have a command button that when clicked allows the user to edit the insurance date information of the Company. I would like this form to display the CompanyName from the original form, plus the insurance date.

Right now as I open each form, I have to do a find to get to the record I had displayed on my original form.
So far I am not sure how to go about this so have no code...Any suggestions
Mar 24 '08 #1
Share this Question
Share on Google+
4 Replies

jeffstl
Expert 100+
P: 432
I have a form that is locked for editing, adding or deleting. Through the use of a command button I open another form, that allows editing, plus allows the user to other areas of the database, through command buttons.
When I click the command button I want to open the second form displaying the CompanyName and information from the first form (the record I had displayed on first form, but open for editing.
On the second form I have a command button that when clicked allows the user to edit the insurance date information of the Company. I would like this form to display the CompanyName from the original form, plus the insurance date.

Right now as I open each form, I have to do a find to get to the record I had displayed on my original form.
So far I am not sure how to go about this so have no code...Any suggestions
txtSecondFormSearch.text = FirstFormName!txtCompanyName.Text

I have no idea if this is what your looking for but this is how you can get values from controls on a different form then the one your working with.

Otherwise you can also use functions to pass your values like parameters from one function to the next. This will work if your functions are declared globally and in a Module as well as the variables you are using. Otherwise the above should work.
Mar 24 '08 #2

P: 4
txtSecondFormSearch.text = FirstFormName!txtCompanyName.Text

I have no idea if this is what your looking for but this is how you can get values from controls on a different form then the one your working with.

Otherwise you can also use functions to pass your values like parameters from one function to the next. This will work if your functions are declared globally and in a Module as well as the variables you are using. Otherwise the above should work.
Well, this gives me a direction.

DoCmd.OpenForm "frmEditCompanyList", acNormal, , , acFormEdit, acWindowNormal
txtfrmEditCompanyListSearch.Text = frmCompanyList!txtCompanyName.Text
DoCmd.Close acForm, "frmCompanyList", acSaveYes

But I don't have it right yet. I appreciate your help.
Mar 24 '08 #3

jeffstl
Expert 100+
P: 432
Well, this gives me a direction.

DoCmd.OpenForm "frmEditCompanyList", acNormal, , , acFormEdit, acWindowNormal
txtfrmEditCompanyListSearch.Text = frmCompanyList!txtCompanyName.Text
DoCmd.Close acForm, "frmCompanyList", acSaveYes

But I don't have it right yet. I appreciate your help.
OK
Is this access? If you are working with VBA in access you might get a better way to do this on the access forums. Also I'm not 100% sure but I thought there was a form wizard that lets you build out a function exactly as you are describing (opening a form on a record based on a value from the current form).

Anyway just wanted to point out too that I think this:

txtfrmEditCompanyListSearch.Text = frmCompanyList!txtCompanyName.Text

Should be in you Form_Load event on the frmEditCompanyListSearch Form probably.
Mar 24 '08 #4

P: 4
OK
Is this access? If you are working with VBA in access you might get a better way to do this on the access forums. Also I'm not 100% sure but I thought there was a form wizard that lets you build out a function exactly as you are describing (opening a form on a record based on a value from the current form).

Anyway just wanted to point out too that I think this:

txtfrmEditCompanyListSearch.Text = frmCompanyList!txtCompanyName.Text

Should be in you Form_Load event on the frmEditCompanyListSearch Form probably.
Thanks, I have it figured. And thought I was in a VBA forum, guess I was not paying attention.
Mar 24 '08 #5

Post your reply

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