Link to home
Create AccountLog in
Avatar of cres1121
cres1121

asked on

Query pulling from a form but values seem odd

I have inherited a very old access project.  I need help understanding what is happening


So you click on the report.. 

Private Sub p9_Click()

On Error GoTo Err_ALLB_Click

 

    Dim stDocName As String

 

    DoCmd.Close

    ObjectName = "Estimated Revenue Report"

    ObjectType = "Report"

    DoCmd.OpenForm "SelectDates"

    

Exit_ALLB_Click:

    Exit Sub

 

Err_ALLB_Click:

    MsgBox Err.Description

    Resume Exit_ALLB_Click

    

End Sub


So it opens a form and you select the beginning and ending date


Private Sub Form_Load()

Calendar0 = "01/01/2022"

Calendar1 = Date

End Sub

 

Private Sub OKB_Click()

On Error GoTo Err_OKB_Click

 

    If IsNull(Calendar0) Then

      MsgBox "You must select a start date!", vbExclamation, ""

      Exit Sub

    End If

    If IsNull(Calendar1) Then

      MsgBox "You must select a end date!", vbExclamation, ""

      Exit Sub

    End If

    StartDay = Calendar0

    StopDay = Calendar1

    DoCmd.Close

    If ObjectType = "Form" Then DoCmd.OpenForm ObjectName

    If ObjectType = "Query" Then DoCmd.OpenQuery ObjectName, acViewPivotChart

    If ObjectType = "Report" Then DoCmd.OpenReport ObjectName, acViewPreview

    If ObjectType = "Macro" Then DoCmd.RunMacro ObjectName

    

Exit_OKB_Click:

    Exit Sub

 

Err_OKB_Click:

    MsgBox Err.Description

    Resume Exit_OKB_Click

    

End Sub


So here is my problem even when I put in new dates in the form it ignores them.


Checked the query tied to the report and the date has a criteria of 

Between getvalue1() And getvalue2()



Can you explain the getvalue and why when I use the report the query is not calling to calendar0 and calendar1?  


Stumped...

thank you



SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account