J
Jay
Hi all -
I'm using a button to open a form with the button's Click event procedure.
Is there an effective VBA technique to set the default value property for the
form's <DamageYear> field to the variable 'strYearOfDamage' ?
The following Click event procedure correctly passes the argument
'strYearOfDamage' to the form's Open event procedure, but I'm having trouble
with the syntax for assigning its value as the default value for the
<DamageYear> field.
Private Sub btnDamages_Click()
On Error GoTo Err_btnDamages_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmE_09_DetailedDamageCategories"
strYearOfDamage = Trim(CStr(Me.reportingYear)) '"2000", "2001", "2002", etc.
stLinkCriteria = "[VesselNumber]=" & "'" & Me![A_VesselNumber] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria, , acDialog, _
strYearOfDamage
Exit_btnDamages_Click:
Exit Sub
Err_btnDamages_Click:
MsgBox Err.Description
Resume Exit_btnDamages_Click
End Sub
- - - - - - - -
Thanks in advance,
Jay
PS: this post will be unattended for about 8hrs.
I'm using a button to open a form with the button's Click event procedure.
Is there an effective VBA technique to set the default value property for the
form's <DamageYear> field to the variable 'strYearOfDamage' ?
The following Click event procedure correctly passes the argument
'strYearOfDamage' to the form's Open event procedure, but I'm having trouble
with the syntax for assigning its value as the default value for the
<DamageYear> field.
Private Sub btnDamages_Click()
On Error GoTo Err_btnDamages_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmE_09_DetailedDamageCategories"
strYearOfDamage = Trim(CStr(Me.reportingYear)) '"2000", "2001", "2002", etc.
stLinkCriteria = "[VesselNumber]=" & "'" & Me![A_VesselNumber] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria, , acDialog, _
strYearOfDamage
Exit_btnDamages_Click:
Exit Sub
Err_btnDamages_Click:
MsgBox Err.Description
Resume Exit_btnDamages_Click
End Sub
- - - - - - - -
Thanks in advance,
Jay
PS: this post will be unattended for about 8hrs.