I am still getting a too few parameter error

kermit5

Registered User.
Local time
Today, 18:16
Joined
Nov 2, 2001
Messages
122
Here is my code:

Private Sub cmdDetailsNext_Click()
'**************************************************************************
'*This sub takes the information entered by the user for the project takeoff
'*and creates a new form.
'*
'**************************************************************************
Dim dbs As Database
Dim rst As Recordset
Dim qdf As QueryDef
Dim fld As Field
Dim frm As Form
Dim control As control
Dim DesignForm As String
Dim NewFormName As String
Dim Buffer As String
Dim bytChoice As Byte
Dim LeftCoord As Integer
Dim TopCoord As Integer
Dim Width As Integer


If IsNull(rst) Then Exit Sub 'run only if records are available

'The following code creates the new form and saves it with a unique _
name, determined by the time it was created.
Set frm = CreateForm
frm.RecordSource = "qryCreateForm"

Buffer = Now()
NewFormName = frm.Name
DesignForm = [ProjectName] & " " & Buffer

DoCmd.Save acForm, NewFormName
DoCmd.Close acForm, NewFormName
DoCmd.Rename DesignForm, acForm, NewFormName

'The following lines open the form in design view and add fields to form

DoCmd.OpenForm DesignForm, acDesign

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("qryCreateForm")
frown.gif
Set rst = qdf.OpenRecordset()
LeftCoord = 1000
TopCoord = 100
Width = 500

For Each fld In rst.Fields
If fld.Name = "Closer" Then
Set control = CreateControl(DesignForm, [FieldControlType], , " ", fld.Name, _
LeftCoord, TopCoord, Width)

End If
Next fld



End Sub

I get the error in the line marked with the frown. I don't seem to see what is missing.

Any ideas?
 
A source string is required in the OpenRecordset method. Try this:


Set rst = qdf.OpenRecordset("qryCreateForm")

Hope this helps,

Peter De Baets
Peter's Software - MS Access Tools for Developers http://www.peterssoftware.com
 

Users who are viewing this thread

Back
Top Bottom