clare_voiant
Board Regular
- Joined
- Mar 20, 2002
- Messages
- 76
Hi,
I am still struggling with some VBA concepts so forgive my crappy coding.... i have adapted some coding to open a form on the right record to try to include a messagebox when the date field 'Copy_Agreement_to_accounts' is greater than 11/08/04 (UK).... and then open an alternative form.
So my question is, why doesnt it work. what happens is the following code will give the messagebox and then open the alternative form, but it does this regardless of what the date is.....
where am i going wrong?
thanks
Clare
On Error GoTo Err_cmdviewclaims_Click
Dim stDocName As String
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "frmClaims"
stDocName1 = "frmBDC"
stLinkCriteria = "[ID]=" & "'" & Me![LT number] & "'"
If Me.Copy_agreement_to_accounts < #11/8/2004# Then
MsgBox "This is a 2004 offer company. Opening BDC's Instead"
DoCmd.OpenForm stDocName1, , , stLinkCriteria
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_cmdviewclaims_Click:
Exit Sub
Err_cmdviewclaims_Click:
MsgBox Err.Description
Resume Exit_cmdviewclaims_Click
End Sub
I am still struggling with some VBA concepts so forgive my crappy coding.... i have adapted some coding to open a form on the right record to try to include a messagebox when the date field 'Copy_Agreement_to_accounts' is greater than 11/08/04 (UK).... and then open an alternative form.
So my question is, why doesnt it work. what happens is the following code will give the messagebox and then open the alternative form, but it does this regardless of what the date is.....
where am i going wrong?
thanks
Clare
On Error GoTo Err_cmdviewclaims_Click
Dim stDocName As String
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "frmClaims"
stDocName1 = "frmBDC"
stLinkCriteria = "[ID]=" & "'" & Me![LT number] & "'"
If Me.Copy_agreement_to_accounts < #11/8/2004# Then
MsgBox "This is a 2004 offer company. Opening BDC's Instead"
DoCmd.OpenForm stDocName1, , , stLinkCriteria
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_cmdviewclaims_Click:
Exit Sub
Err_cmdviewclaims_Click:
MsgBox Err.Description
Resume Exit_cmdviewclaims_Click
End Sub