[AccessD] Set Recordsource of sub Form

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Tue Apr 15 15:44:24 CDT 2008


Nice.  One for the archives.

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Tuesday, April 15, 2008 1:18 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Set Recordsource of sub Form

Rocky,
You may also find this useful for the future:-

I have a list of buttons on a sub form (PeoplePopSub1) and when a user
clicks one, the second sub form changes.

Here is an example where the user clicked to see a person addresses:

[Forms]![MCM_Peoplemainform]![PeoplePopSub2].SourceObject =
"MCM_PeoplePopAddress"

Click on the NAME Tab of the properties and MAKE SURE you have the correct
<NAME> for the sub form (in my example it is PeoplePopSub2)

Here is how it is used.
On the click event of the button ADDRESSES I have:-

OnMouseDown event I have =pfOpenPeoplePopForms("MCM_PeoplePopAddress")
OnKeyUp event I also have the same
=pfOpenPeoplePopForms("MCM_PeoplePopAddress")

in the function I have:

Public Function pfOpenPeoplePopForms(strForm As String) ' set the subform
and link to person in main form
  [Forms]![MCM_Peoplemainform]![PeoplePopSub2].SourceObject = strForm
  If strForm = "MCM_PeoplePopInitial" Then
    [Forms]![MCM_Peoplemainform]![PeoplePopSub2].LinkChildFields = ""
    [Forms]![MCM_Peoplemainform]![PeoplePopSub2].LinkMasterFields = ""
  Else
    [Forms]![MCM_Peoplemainform]![PeoplePopSub2].LinkChildFields =
"PersonID"
    [Forms]![MCM_Peoplemainform]![PeoplePopSub2].LinkMasterFields =
"PersonID"
  End If
End Function

As you can see, I also change the links in this function

HTH
Max

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.13/1377 - Release Date: 4/14/2008
9:26 AM
 




More information about the AccessD mailing list