I haven't delved terribly deep into the usage of Queries and SQL just yet, but I think I am starting to get the hang of it. Anyway, my question is this: I have a SQL statement which creates a new query (works great so far), but I want to be able to view the query as soon as it is made (for now). Can I add something to or change something in the code I have posted here:
??
Suggestions? I'm thinking it's probably something simple, I am just unaware of it..
Stephen![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
Code:
Private Sub cmbStatus_AfterUpdate()
Dim strQueryName As String
strQueryName = Me.cmbTeamLeader & " " & Me.cmbStatus
Dim myquery As QueryDef
Set myquery = CurrentDb.CreateQueryDef([strQueryName], _
"SELECT tblStatusAudit.Year, tblStatusAudit.Month, " & _
"tblStatusAudit.Director, " & _
"tblStatusAudit.Manager, tblStatusAudit.[Team Leader], " & _
"tblStatusAudit.Status " & _
"FROM tblStatusAudit " & _
"WHERE (((tblStatusAudit.[Team Leader])=[Forms]!" & _
"[frmAuditReviewSelection]![cmbTeamLeader]) " & _
"AND ((tblStatusAudit.Status)=[Forms]!" & _
"[frmAuditReviewSelection]![cmbStatus]));")
Suggestions? I'm thinking it's probably something simple, I am just unaware of it..
Stephen
![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV