Use of RecordSet

N

NEWER USER

I am having some difficulty geeting the RecordSet property to work. I am
trying to use ONE form to display records differently rather than creating
separate forms and subforms. My form is titled frmGrouping and has its
RecordSet as qryGrouping. I want to change the Recordset to
"qryProductGrpPads" when the form opens. The only difference in the two
queries is one table that I build prior to opening the form. I have the
following code attached to a Command button on a Form used to call the form.

On Error GoTo Err_Alternates_Click
Dim strDoc As String
Dim strDoc1 As String
Dim strDoc2 As String

strDoc = "qryMakeTableGrpPads"
strDoc1 = "frmGrouping"
strDoc2 = "qryProductGrpPads"

DoCmd.SetWarnings False
DoCmd.OpenQuery strDoc, acNormal, acEdit
DoCmd.OpenForm strDoc1, acNormal, "", "", , acNormal
Me.RecordSource = strDoc2
DoCmd.SetWarnings True

Exit_Alternates_Click:
Exit Sub

Err_Alternates_Click:
MsgBox Err.Description
Resume Exit_Alternates_Click

The form is opening BLANK; The Recordset is not substituing in place of the
one defined in the form properties. Any help appreciated.
 
M

Maurice

Try:

DoCmd.SetWarnings False
DoCmd.OpenQuery strDoc, acNormal, acEdit
DoCmd.OpenForm strDoc1, acNormal
me.recordsource=""
Me.RecordSource = "qryProductGrpPads"
DoCmd.SetWarnings True


hth
 
N

NEWER USER

Same Result - Blank Form-no records

Maurice said:
Try:

DoCmd.SetWarnings False
DoCmd.OpenQuery strDoc, acNormal, acEdit
DoCmd.OpenForm strDoc1, acNormal
me.recordsource=""
Me.RecordSource = "qryProductGrpPads"
DoCmd.SetWarnings True


hth
 
J

John W. Vinson

Same Result - Blank Form-no records

Have you verified that qryProductGrpPads does in fact return records? If it
does not, and if it is not updateable (a grouped query won't be), you'll get a
totally blank form. What do you see when you open the query in datasheet view?
 

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