Called Form

G

Gary

I have a simple database used here at work that performs
the following activate event:
Private Sub Form_Activate()
DoCmd.RunCommand acCmdDocRestore
End Sub

This form is called from a previous form that executes an
SQL query to retrieve records. If there is 1 record that
meets the query criteria, the form is called using the
following:
If rst.RecordCount = 1 Then
Dim stLinkCriteria As String
stLinkCriteria = "[ID]=" & rst![ID]
DoCmd.OpenForm "frmMaster", , , stLinkCriteria
Else
DoCmd.OpenForm "frmSelect", , , stLinkCriteria
End If

I am calling the Form frmMaster. The problem is no
records are ever loaded into frmMaster unless I return to
the calling form and re-execute the query *without*
closing out the frmMaster Form. Then, my record shows
up. I am out of ideas.
 
G

Gary

Graham,

I did some searching after I posted this question, and it
looked like I needed to set my form to "No" for Data
Entry. I will implement your solution as well. Thank you
for your assistance.

-----Original Message-----
Gary,

Before the "If rst.RecordCount = 1 Then" line, add the following code:
rst.MoveLast
rst.MoveFirst

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd- 0764559036.html


I have a simple database used here at work that performs
the following activate event:
Private Sub Form_Activate()
DoCmd.RunCommand acCmdDocRestore
End Sub

This form is called from a previous form that executes an
SQL query to retrieve records. If there is 1 record that
meets the query criteria, the form is called using the
following:
If rst.RecordCount = 1 Then
Dim stLinkCriteria As String
stLinkCriteria = "[ID]=" & rst![ID]
DoCmd.OpenForm "frmMaster", , , stLinkCriteria
Else
DoCmd.OpenForm "frmSelect", , , stLinkCriteria
End If

I am calling the Form frmMaster. The problem is no
records are ever loaded into frmMaster unless I return to
the calling form and re-execute the query *without*
closing out the frmMaster Form. Then, my record shows
up. I am out of ideas.


.
 

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