G'day Accessians
My Stocktake system has 2 different reports to chose from - one ordered by issue date, the other ordered by type of issue.
I've added a simple Yes/No column to my table to decide which report to open.
I've attempted to sus out the appropriate VBA but i just can't get it to work properly.
I'm sure it's just a syntax error or something fundamental. I'm trying to wean myself off macros and queries and learn me some VBA
My Stocktake system has 2 different reports to chose from - one ordered by issue date, the other ordered by type of issue.
I've added a simple Yes/No column to my table to decide which report to open.
I've attempted to sus out the appropriate VBA but i just can't get it to work properly.
Code:
Private Sub openreport_click()
Dim reporttype As String
reporttype = DLookup("reportbytype", "tblagency", "agencyID = [forms]![frmnavigation]![masterfilter]")
If reporttype = vbYes Then
DoCmd.openreport "rptIssueStocktake", acViewNormal, "", "", acWindowNormal
End If
If reporttype = vbNo Then
DoCmd.openreport "rptDatestocktake", acViewNormal, "", "", acWindowNormal
End If
End Sub
I'm sure it's just a syntax error or something fundamental. I'm trying to wean myself off macros and queries and learn me some VBA