Open Form change record source (1 Viewer)

naobao

Registered User.
Local time
Yesterday, 16:03
Joined
Feb 13, 2014
Messages
76
Hi,

I use this code in form button, to open another form, but is not work...

Form!CHECK_OUT_1.Form.RecordSource = "CHECK_OUT_data_1"
DoCmd.OpenForm "CHECK_OUT_1", acFormDS, "", "", acReadOnly, acNormal
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:03
Joined
May 7, 2009
Messages
19,229
use CHECK_OUT_1 form's Open Event:

private sub form_open(cancel as integer)
me.recordsource="CHECK_OUT_data_1"
end sub
 

naobao

Registered User.
Local time
Yesterday, 16:03
Joined
Feb 13, 2014
Messages
76
use CHECK_OUT_1 form's Open Event:

private sub form_open(cancel as integer)
me.recordsource="CHECK_OUT_data_1"
end sub

I need to open "CHECK_OUT_1" form's by different record source,
so need to open by different button, can't use Open Event.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:03
Joined
May 7, 2009
Messages
19,229
passed the recordsource as parameter:

DoCmd.OpenForm "CHECK_OUT_1", acFormDS, "", "", acReadOnly, acNormal,"CHECK_OUT_data_1"


again on the open event of CHECK_OUT_1 form:


private sub form_open(cancel as integer)
if not isnull(me.openargs) then _
me.recordsource=me.openargs & ""
end sub
 

naobao

Registered User.
Local time
Yesterday, 16:03
Joined
Feb 13, 2014
Messages
76
passed the recordsource as parameter:

DoCmd.OpenForm "CHECK_OUT_1", acFormDS, "", "", acReadOnly, acNormal,"CHECK_OUT_data_1"


again on the open event of CHECK_OUT_1 form:


private sub form_open(cancel as integer)
if not isnull(me.openargs) then _
me.recordsource=me.openargs & ""
end sub
Thanks so much!!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:03
Joined
May 7, 2009
Messages
19,229
ur welcome.
 

Users who are viewing this thread

Top Bottom