Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control 2 forms with 1 command button

Status
Not open for further replies.

macdoggy

Technical User
Dec 21, 2007
12
US
Hi, Does anyone know how I can control 2 forms with 1 command button?

I have a form with 2 subforms, one is linked and one is not linked. I want to put a command button on the linked form that when clicked will

1. Move to a new record on the linked subform, and
2. Move to the next record on the non-linked subform.

I have this in my event procedure:

DoCmd.GoToRecord , , acNewRec
DoCmd.GoToRecord , [Forms]![frmCityState]![tblQuestions subform], acNext

and I get the error message that, "An expression you entered is the wrong data type for one of the arguments."

Thanks!
 
First go to the control and then go to the record.
 
I get the same message. Am I putting in my form name incorrectly?

I have

DoCmd.GoToControl [Forms]![frmCityState]![tblQuestions subform]

I thought [Forms]! told Access it was a form, [frmCityState]! is my main form, [tblQuestions subform] is my subform ...
 
With GoToControl, you need the name of the control as a string.

I guess [Forms]![frmCityState] is you current form, so:

DoCmd.GoToControl "tblQuestions subform
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top