B
Barth Wilsey
I have used the form wizard to try to open a second form to the same record
that was being edited on the first form
The linked criteria involve the Field ID, [ID], which is the key field set
up to be analogous to an autonumber (using a long integer format that when a
new record is made just adds one to the value of the last record) and the
value in a text box, Me![txtDurationID]
Instead of the second form opening with the [ID] of the first form, it opens
a new record. I have tried to make Allowadditions = false in the second
form. However, when I do this, the second form opens as a blank form without
controls
Below is the code:
Private Sub cmdOpenAveragePain_Click()
On Error GoTo Err_cmdOpenAveragePain_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAveragePain"
stLinkCriteria = "[ID]=" & Me![txtDurationID]
'DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm stDocName, , , "[ID] ='" & Me![txtDurationID] & "'"
Exit_cmdOpenAveragePain_Click:
Exit Sub
Err_cmdOpenAveragePain_Click:
MsgBox Err.Description
Resume Exit_cmdOpenAveragePain_Click
End Sub
thanks in advance for any help, Barth
that was being edited on the first form
The linked criteria involve the Field ID, [ID], which is the key field set
up to be analogous to an autonumber (using a long integer format that when a
new record is made just adds one to the value of the last record) and the
value in a text box, Me![txtDurationID]
Instead of the second form opening with the [ID] of the first form, it opens
a new record. I have tried to make Allowadditions = false in the second
form. However, when I do this, the second form opens as a blank form without
controls
Below is the code:
Private Sub cmdOpenAveragePain_Click()
On Error GoTo Err_cmdOpenAveragePain_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAveragePain"
stLinkCriteria = "[ID]=" & Me![txtDurationID]
'DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm stDocName, , , "[ID] ='" & Me![txtDurationID] & "'"
Exit_cmdOpenAveragePain_Click:
Exit Sub
Err_cmdOpenAveragePain_Click:
MsgBox Err.Description
Resume Exit_cmdOpenAveragePain_Click
End Sub
thanks in advance for any help, Barth