Hi
I am using the code below to look at a table to identify a sub name in a module that I want to run, but I get an error message saying Compile Error, expected sub. It looks like it is something to do with the sub name variable as I am using String. Can anyone help!
Sub Update()
Dim rNames As DAO.Recordset
Dim db As DAO.Database
Dim strSubNames As String
Set db = CurrentDb
DoCmd.Echo False
DoCmd.SetWarnings False
Set rsNames = CurrentDb.OpenRecordset("SELECT tblReportProduction.[Report Name], tblReportProduction.[Sub Name], tblReportProduction.Available, tblReportProduction.AutoNumber FROM tblReportProduction WHERE (((tblReportProduction.Available)=Yes));")
Do While Not rsNames.EOF
strSubNames = rsNames.[Sub Name]
Call strSubNames
Set db = Nothing
DoCmd.Echo True
rsNames.MoveNext
Loop
rsNames.Close
DoCmd.Echo True
End Sub
I am using the code below to look at a table to identify a sub name in a module that I want to run, but I get an error message saying Compile Error, expected sub. It looks like it is something to do with the sub name variable as I am using String. Can anyone help!
Sub Update()
Dim rNames As DAO.Recordset
Dim db As DAO.Database
Dim strSubNames As String
Set db = CurrentDb
DoCmd.Echo False
DoCmd.SetWarnings False
Set rsNames = CurrentDb.OpenRecordset("SELECT tblReportProduction.[Report Name], tblReportProduction.[Sub Name], tblReportProduction.Available, tblReportProduction.AutoNumber FROM tblReportProduction WHERE (((tblReportProduction.Available)=Yes));")
Do While Not rsNames.EOF
strSubNames = rsNames.[Sub Name]
Call strSubNames
Set db = Nothing
DoCmd.Echo True
rsNames.MoveNext
Loop
rsNames.Close
DoCmd.Echo True
End Sub