how to pass the parameter into access query through form

I write one query in which I want it will create new table and copy the existing table data into new one.

this query is working.

but I want to pass the new tablename value through textbox of form and when I click button it will pass the textbox value to query and it will create the new table.

but error is coming which is shown below.

Public Sub CreateTable(tblName As String)
On Error GoTo GereErr
    Dim qdf As QueryDef
    Set qdf = CurrentDb.QueryDefs(tblName)
      With qdf
         .Execute
      End With
Exit Sub
GereErr:
    MsgBox Err.Description, vbCritical + vbOKOnly
    Application.Echo True
    DoCmd.Hourglass False
    Err.Clear
End Sub

May 14th, 2015 5:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics