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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linked form instead of sub form

Status
Not open for further replies.

weezles

Technical User
Jul 18, 2003
81
GB
hi

I'm having trouble with using a linked form instead of a sub form on a 1 to many relationship. Then linked form can be accessed from various other forms. When it opens the linked form, if there are no records the clientID is 0.
I tried the code behind the button to open the linked form.

Code:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm "frmLinked", , , stLinkCriteria

If Forms!frmMain!ClientID = 0 Then
        Forms!frmLinked!ClientID = Forms!frmMain!ClientID
End If

I would set the default value of ClientID to:
Forms!frmMain!ClientID
but as the parent form could be any of many I need to find another way.


Help

Lou
 
Have you tried to replace this:
If Forms!frmMain!ClientID = 0 Then
with this ?
If Forms!frmLinked!ClientID = 0 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes sorry my mistake when changing the form names to supposedly make it easier to read.
Code:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm "frmLinked", , , stLinkCriteria

If Forms!frmLinked!ClientID = 0 Then
        Forms!frmLinked!ClientID = Forms!frmMain!ClientID
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top