Situation: I currently have a query called qryAprilAdjustYearStartEndDate to update to date fields in a table called tblCompanyFacts. This table has one record and holds the start and ending dates for three different time periods. The query works as advertised, but I would like to take the query out and code the changes. I tried DateAdd(“yyyy”,1,[tblCompanyFacts.AprilStart]) and get error message saying need equal sign.
Second question: Once the code is run I want to make cmdApril invisible. I tried using cmdApril.Visible = False. I tried it in Select Case intAnswer2 and below that without success (See whole block of code below.)
Thank you for your assistance. Fay
Private Sub cmdApril_Click()
Dim intAnswer As Integer
Dim intAsnwer2 As Integer
‘ Check to make sure that you are ready to print the final year end report
intAnswer = MsgBox(“Is all data entered? Are you ready to output the year end report?”, vbYesNo + vbQuestion, “Print End of Year Report”)
Select Case intAnswer
Case vbYes
cmdApril.Tag = “Yes”
DoCmd.OpenReport “rptJonCombined”
Case vbNo
cmdApril.Tag = “” ‘ Used to emplty it in case it is still there from a previous action
DoCmd.Close , acForm
End Select
‘ Check to make sure that you are ready update the year starting and ending dates
intAnswer2 = MsgBox(“Was everything printed satisfactory? If so are you ready to update the starting and ending dates for the year?”, vbYesNo + vbQuestion, “Print End of Year Report”)
Select Case intAnswer2
Case vbYes
DoCmd.OpenQuery “qryAprilAdjustYearStartEndDate”, acViewNormal, acReadOnly
Case vbNo
DoCmd.Close , acForm
End Select
cmdApril.Visible = False
End Sub