"Rick" <(E-Mail Removed)> wrote in
news:K4Jab.506345$(E-Mail Removed):
> For example, the following:
> strsql = "SELECT ClientID, RegistrationDate, " & _
> " BabyActualDate, Father " & _
> "FROM Clients" & _
> "WHERE RegistrationDate<" &
> Format(dteFYStart, "\#yyyy\-mm\-dd\#") & ";"
' Create a qerydef to hold it
' Actually, making it a parameter query would make the whole
' lot a bunch easier...
Set qdf = dbsBITO.CreateQueryDef("rnsTemp", strSQL)
' show it for debugging
DoCmd.OpenQueryDef "rnsTemp"
' Ask the user if it looks right: but out if it doesn't
If MsgBox("OK???",vbYesNo) <> vbYes then
Exit Sub
End If
' Okay, now open it as a recordset
Set rstClients = dbsBITO.Querydefs("rnsTemp").OpenRecordset _
dbOpenSnapshot, dbForwardOnly
' other stuff here, and then don't forget to
dbsBITO.QueryDefs.Delete "rnsTemp"
Hope that helps
Tim F
|