I am trying to make a more complicated piece of code than this, but I have started to break it down and I think if I can get this bit to work I can sort out the rest.
Basically I want the code below to work but it is getting snagged on the DoCmd.OpenQuery rst1 bit, it seems to be fine with the SQLstring but then I'm doing something wrong when I try to turn it into an actual query.
Can someone please tell me what I need to make the code work?
Thanks.
Private Sub Command257_Click()
Dim dbs As Database, rst1 As Recordset
Dim SQLString As String
SQLString = "SELECT ELTDistributionReport.*" _
& " FROM ELTDistributionReport" _
& " WHERE (([Owner]='Andrew Cowan'));"
Set dbs = CurrentDb
Set rst1 = dbs.OpenRecordset(SQLString, dbOpenSnapshot)
DoCmd.OpenQuery rst1
End Sub
Basically I want the code below to work but it is getting snagged on the DoCmd.OpenQuery rst1 bit, it seems to be fine with the SQLstring but then I'm doing something wrong when I try to turn it into an actual query.
Can someone please tell me what I need to make the code work?
Thanks.
Private Sub Command257_Click()
Dim dbs As Database, rst1 As Recordset
Dim SQLString As String
SQLString = "SELECT ELTDistributionReport.*" _
& " FROM ELTDistributionReport" _
& " WHERE (([Owner]='Andrew Cowan'));"
Set dbs = CurrentDb
Set rst1 = dbs.OpenRecordset(SQLString, dbOpenSnapshot)
DoCmd.OpenQuery rst1
End Sub