Create Form Problem

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
 
J

Jonathan Parminter

-----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
 

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