Create Form Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a form that allows the user to enter parameters for an ad hoc query. I would like the query result to display in datasheet view of a new form. I've tried CreateForm (see code below), but all that happens is that Form1 pops up, remains in design view, and the query's field list is displayed. I'm sure I'm missing something basic, so any help is appreciated.

Set frm = CreateForm
DoCmd.Restore
With frm
.DefaultView = 2
.RecordSource = SQLstmt
End With

Bob
 
-----Original Message-----
I've got a form that allows the user to enter parameters
for an ad hoc query. I would like the query result to
display in datasheet view of a new form. I've tried
CreateForm (see code below), but all that happens is that
Form1 pops up, remains in design view, and the query's
field list is displayed. I'm sure I'm missing something
basic, so any help is appreciated.
Set frm = CreateForm
DoCmd.Restore
With frm
.DefaultView = 2
.RecordSource = SQLstmt
End With

Bob
.
Hi Bob,
if the form already exists, then you don't have to switch
to design view to change its recordsource.

simply use
forms("CreateForm").recordsource=SQLstmt


Luck
Jonathan
 
Back
Top