How do I open a from and a subform based on criteria? (1 Viewer)

Angelflower

Have a nice day.
Local time
Today, 15:13
Joined
Nov 8, 2006
Messages
51
I have a form that opens up for the user and allows the user can pick a member name. What I want is that once member name is selected the Main form (Providers) opens up at the members name (Subform). I can get the main form to open up with the correct provider but I am having trouble getting it to open up on the correct member name.

This is the code I have so far:

Private Sub MemberName_Click()
On Error GoTo Err_MemberName_Click
'Opens Incoming_Invoices form for member selected
Dim stDocName As String
Dim stLinkCriteria As String

'Main form
stDocName = "Incoming_Invoices"
'Links Provider Name and opens up the Main form of Incoming Invoices
stLinkCriteria = "[DE_fullname]=" & "'" & Me![Provider Name] & "'"

DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_MemberName_Click:
Exit Sub

Err_MemberName_Click:
MsgBox Err.Description
Resume Exit_MemberName_Click

End Sub
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:13
Joined
Jul 9, 2003
Messages
16,282
>>>opens up at the members name (Subform)<<<<

Do you mean a separate form? Or is the form imbedded in your main form?
 

Users who are viewing this thread

Top Bottom