Please review the updated code below (use the code tags -#- in the forum to post code to preserve indentation):
Code:
Private Sub Reportcmd_Click()
Dim stDocName As String
'Dim stLinkCriteria As String
stDocName = "Graph_Rpt"
DoCmd.OpenReport stDocName, acViewPreview ', , stLinkCriteria, acNormal
MsgBox "Graph", vbInformation, "Testing"
End Sub
Private Sub Report_Open(Cancel As Integer)
'Dim stDocName As String
'Dim stLinkCriteria As String
Dim SystemDateRun As Date 'String
'stDocName = "Report_Graph_Rpt"
SystemDateRun = #01/01/2010# 'if it is a date you need to declare it as date and wrap it in #; if left as string you need to use the CDate() function when you assign it to the textbox
If Nz([Forms]![Graph_Frm]![fStartDatetxt]) = "" Then
Me.rStartDatetxt = SystemDateRun 'if left as string her you should have CDate(SystemDatetxt)
Else
Me.rStartDatetxt = [Forms]![Qsys_GrafAccDep_Frm]![fStartDatetxt]
End If
If Nz([Forms]![ Graph_Frm]![fEndDatetxt]) = "" Then
Me.rEnddatetxt = Date
Else
Me.rEnddatetxt = [Forms]![Graph_Frm]![fEndDatetxt]
End If
End Sub
Cheers,