Need help displaying finds in a form.

T

Tom

I have a search form that allows you to select a table or query and then
specify the field and criteria. It is designed with a button at the bottom
that creats a query (Create Query). The button uses this code below, and
creates the query displaying the results in an unbound object frame in the
form in a table type format. I would like help modifying the code to open an
existing form (searchresults) and display the results there instead with the
option of navigating through the records that come back as hits from the
query. I am really not a programmer, so I need help adding or modifying the
code in this string so that the results display in this form.

Private Sub cmdCreateQDF_Click()
On Error GoTo ErrHandler
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strName As String
'first get a unique name for the querydef object
strName = Application.Run("acwzmain.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)
qdf.Close
Else
'ok, so they don't want to
MsgBox "The save operation was cancelled." & vbCrLf & _
"Please try again.", vbExclamation + vbOKOnly, "Cancelled"
End If
ExitHere:
On Error Resume Next
qdf.Close
Set qdf = Nothing
db.QueryDefs.Refresh
Set db = Nothing
Exit Sub
ErrHandler:
Resume ExitHere
End Sub

Thanks to anyone that can assist in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top