I have created a pop-up which is supposed to have default values passed on from its originating control. It seems to work properly when a record already exists, but does not pass values when a new record has been added. I know that I need to tweek my code to be more specific about where the default values are coming from but I also may be missing something else to allow new records to function properly. The code that I am using is as follows:
Private Sub Form_Load()
Dim bb As String
bb = SESSIONS.Port
[SESSIONS SOURCES].Port.DefaultValue = Val(bb)
Dim cc As String
cc = SESSIONS.[Session ID]
[SESSIONS SOURCES].Session_ID.DefaultValue = Val(cc)
Dim dd As String
dd = SESSIONS.[Sender Comp ID]
[SESSIONS SOURCES].[Sender Comp ID].DefaultValue = """" & dd & """"
End Sub
Private Sub btMultiple_Sources_Click()
Dim strWhere As String
strWhere = "[Session ID]=" & Me.Session_ID
DoCmd.OpenForm "SESSIONS SOURCES", , , strWhere, OpenArgs:="[Port]" & "[Sender Comp ID]" & "[Session ID]=" & Me.Session_ID
End Sub
Attempting to provide where Port, Session ID, or Sender Comp ID are coming from. Receiving an error "Object required".
Control "Port" is on subform "SESSIONS". Trying to pass this to control "Port" on subform "SESSIONS SOURCES".
Control "Sender Comp ID" is on subform "SESSIONS". Trying to pass this to control "Sender Comp ID" on subform "SESSIONS SOURCES".
Control "Session ID" is on subform "SESSIONS". Trying to pass this to control "Session ID" on subform "SESSIONS SOURCES".
Private Sub Form_Load()
Dim bb As String
bb = SESSIONS.Port
[SESSIONS SOURCES].Port.DefaultValue = Val(bb)
Dim cc As String
cc = SESSIONS.[Session ID]
[SESSIONS SOURCES].Session_ID.DefaultValue = Val(cc)
Dim dd As String
dd = SESSIONS.[Sender Comp ID]
[SESSIONS SOURCES].[Sender Comp ID].DefaultValue = """" & dd & """"
End Sub
Private Sub btMultiple_Sources_Click()
Dim strWhere As String
strWhere = "[Session ID]=" & Me.Session_ID
DoCmd.OpenForm "SESSIONS SOURCES", , , strWhere, OpenArgs:="[Port]" & "[Sender Comp ID]" & "[Session ID]=" & Me.Session_ID
End Sub
Attempting to provide where Port, Session ID, or Sender Comp ID are coming from. Receiving an error "Object required".
Control "Port" is on subform "SESSIONS". Trying to pass this to control "Port" on subform "SESSIONS SOURCES".
Control "Sender Comp ID" is on subform "SESSIONS". Trying to pass this to control "Sender Comp ID" on subform "SESSIONS SOURCES".
Control "Session ID" is on subform "SESSIONS". Trying to pass this to control "Session ID" on subform "SESSIONS SOURCES".