Form/SubForm Problem

John Baker

Registered User.
Local time
Today, 01:56
Joined
Apr 13, 2005
Messages
35
Hi All - looking for some help with a form/subform problem that I am experiencing.

I have a main form (frm_local) that has 1 subform (sfrm_local_ims). Each form is based on a different query. I have 'linked' the main form and subform using the 'Link Child Fields' and 'Link Master Fields' properties of the subform control.

When the main form loads, the subform also loads the data related to the main form. However, here is the hitch: I want to go to a specific record number in the dataset displayed in the subform, based on the value of a control in the main form.

I have created a command button control on the main form labeled 'Get Data' and have coded the following Event Procedure in an attempt to have the subform move to the desired record number in the dataset:

Private Sub cmdGetData_Click()

gintRecord = Me!ninetyfivepctl
DoCmd.GoToRecord acDataForm, Forms![frm_local]![sfrm_local_ims].Form, acGoTo, gintRecord

End Sub


However, when I attempt to execute this code, I get the following run-time error (2498):

"An expression you entered is the wrong data type for one of the arguments".

Any help with this problem would be greatly appreciated!

Thanks,
John
 
Solution Found!

After doing addition research in this forum, I have solved the problem. Here is the code I used to get the result I was looing for:

Forms![frm_local]![sfrm_local_ims].SetFocus
DoCmd.GoToRecord,,acGoTo,gintRecord

Simple enough!

John
 

Users who are viewing this thread

Back
Top Bottom