Guus2005
AWF VIP
- Local time
- Today, 09:12
- Joined
- Jun 26, 2007
- Messages
- 2,642
In my application users are allowed to create their own queries. I call them user queries.
User queries are lost each time the Frontend on the network is copied to the users temporary directory overwriting the Frontend containing the user queries. So i have come up with a method to store the user queries in a table and they are recreated each time the user starts the application.
I have a string variable which can contain three characters (a3)
The complete function:
My question is: It is a bit dirty (like cheating) but is this valid code?
I want to make sure that in future versions of Access (2007, 2010, ...) this code still works.
Thx!
User queries are lost each time the Frontend on the network is copied to the users temporary directory overwriting the Frontend containing the user queries. So i have come up with a method to store the user queries in a table and they are recreated each time the user starts the application.
I have a string variable which can contain three characters (a3)
Code:
a3 = "qruLongQuery"
?a3
qru
The complete function:
Code:
Public Function SaveUserQueries() As Boolean
'Store query in table when prefix match qru (user) or qra (all)
Dim qdf As QueryDef
Dim a3 As String * 3 'Only three characters
DeleteUserQueries 'Delete queries allready stored.
For Each qdf In CurrentDb.QueryDefs
a3 = LCase$(qdf.name)
If a3 = "qru" Or a3 = "qra" Then 'If LCase$(Left$(qdf.name, 3)) = "qru" Or LCase$(Left$(qdf.name, 3)) = "qra" Then
SaveUserQuery qdf.name
End If
Next qdf
End Function
I want to make sure that in future versions of Access (2007, 2010, ...) this code still works.
Thx!