Custom Save Query function not working in Access2002.
Posted on 2003-03-24
I have a Access97 database that has a custom for for creating queries. On the form is a button for activating the code. The code is posted below.
It references the wzmain80.wlib_stUniquedocname.
My problem is this. I have migrated the application to Access2002. This particular code no longer works. I have tried adding the file wzmain80 into the references, but as it is an assess97 mde file Access2002 won't reference it.
The users run the front end as a MDE as well. How to I get this to work in Access2002.
Thanking you all in advance and greatfully appreciating all help.
Private Sub cmdCreateQDF_Click()
On Error GoTo Error_cmdCreateQDF
Dim db As Database
Dim qdf As QueryDef
Dim strName As String
'first get a unique name for the querydef object
strName = Application.Run("wzmain80.wlib_stUniquedocname", "Query1", acQuery)
strName = InputBox("Please specify a query name", "Save As", strName)
If Not strName = vbNullString Then
'only create the querydef if user really wants to.
Set db = CurrentDb
Set qdf = db.CreateQueryDef(strName, Me.txtSQL)
'ok, so they don't want to
'MsgBox "The save operation was cancelled." & vbCrLf & _
' "Please try again.", vbExclamation + vbOKOnly, "Cancelled"
On Error Resume Next
Set qdf = Nothing
Set db = Nothing