I have one form (Form3)which has the following code
Private Sub ladder_date_DblClick(Cancel As Integer)
DoCmd.OpenForm "NAV_bound", , , "ladder_date = " & [Forms]![FORM3]![ladder_date]
End Sub
where ladder_date is the date on the form. I then want it to open the form NAV_bound. And I want NAV_bound to open on the ladder_date that was double clicked on from the previous form (Form3)
For Form NAV_bound
I load the form as such
Private Sub Form_Load()
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.Path & "\test.mdb;"
'create a new connection instance and open it using the connection string
Set cnNAV1 = New ADODB.Connection
cnNAV1.Open strConnection
'create a new instance of a recordset
Set rsNAV1 = New ADODB.Recordset
'set various properties of the recordset
With rsNAV1
'specify a cursortype and lock type that will allow updates
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
'open the recordset based on tblContacts table using the existing connection
.Open "tblPerformance", cnNAV1
End With
'if the recordset is empty
If rsNAV1.BOF And rsNAV1.EOF Then
Exit Sub
Else
End If
Set Me.Recordset = rsNAV1
Me.dtladder_date.ControlSource = "ladder_date"
'close the database connection and release it from Memory
End Sub
and it always open to first recod in the table, ignoring the date I double click on the previous form. How can I load the form such that I get the desired result.
Note: using
Dim cnNAV1 As ADODB.Connection
Dim rsNAV1 As ADODB.Recordset
Private Sub ladder_date_DblClick(Cancel As Integer)
DoCmd.OpenForm "NAV_bound", , , "ladder_date = " & [Forms]![FORM3]![ladder_date]
End Sub
where ladder_date is the date on the form. I then want it to open the form NAV_bound. And I want NAV_bound to open on the ladder_date that was double clicked on from the previous form (Form3)
For Form NAV_bound
I load the form as such
Private Sub Form_Load()
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.Path & "\test.mdb;"
'create a new connection instance and open it using the connection string
Set cnNAV1 = New ADODB.Connection
cnNAV1.Open strConnection
'create a new instance of a recordset
Set rsNAV1 = New ADODB.Recordset
'set various properties of the recordset
With rsNAV1
'specify a cursortype and lock type that will allow updates
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
'open the recordset based on tblContacts table using the existing connection
.Open "tblPerformance", cnNAV1
End With
'if the recordset is empty
If rsNAV1.BOF And rsNAV1.EOF Then
Exit Sub
Else
End If
Set Me.Recordset = rsNAV1
Me.dtladder_date.ControlSource = "ladder_date"
'close the database connection and release it from Memory
End Sub
and it always open to first recod in the table, ignoring the date I double click on the previous form. How can I load the form such that I get the desired result.
Note: using
Dim cnNAV1 As ADODB.Connection
Dim rsNAV1 As ADODB.Recordset