NOTE: If you will be using a temporary query, would suggest creating a query on main form open, using that query for all changes while the form is open, then deleting the query -- db.querydefs.delete "myTempQuery" -- on main form close. If you have multiple users accessing your database, would suggest this approach, as opposed to a single query used for all updates.
Main Topics
Browse All Topics





by: mcallarsePosted on 2003-03-03 at 11:47:57ID: 8059551
Can create and/or edit QueryDefs on the fly using VB(A):
).SQL = strSQL
Dim db
Dim qd As New QueryDef
Set db = CurrentDb
strSQL = "select * from myTable"
With qd
.Name = "myTempQuery"
.SQL = strSQL
End With
db.QueryDefs.Append qd
' Following to illustrate Edit only.
db.QueryDefs("myTempQuery"
Set qd = Nothing: Set db = Nothing
' Set SubForm SourceObject
mySubForm.SourceObject = "Query.myTempQuery"
--