Another Sub Form requery question

D

David

Hello,
I have read all of the posts that discuss subform requery, but can not get
this right. Any help is very much appreciated. This is driving me crazy.

Main Form:frm_Call_Routing_Team_All
SubForm Control Name: sfrm_Status
Common link is a field titled: UniqueID

I have a bit of code that will append the UniqueID to the Status table if
needed. This is the record source for my subform.
Before the Main form is opened, the Status table is blank, so I expect the
subform to no display any records. I run an append query to add the record
to the Status table. I would like to then requery the subform to display the
newly added data.

I have tried all of the ways listed below. Only me.requery redisplays the
subform without navigating to the next record and back, but it also resets
the record pointer.

In the On Current Event of the Main form, I have this code.

'****************************
Private Sub Form_Current()

Dim tempCount As Integer


tempCount = DCount("*", "qry_Check_UniqueID")

If tempCount < 1 Then 'UniqueID doesn't exist in Status Table
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Add_UniqueID" 'This adds UniqueID to Status table

'Me.sfrm_Status.Requery
'Me.Refresh
'Me.Requery
'Me.sfrm_Status.Refresh
'Me.sfrm_Status.Repaint
' Me![sfrm_Status].Form.Requery
' Me.sfrm_Status.Requery
'Me![sfrm_Status].Form.Refresh
'Forms![frm_Call_Routing_Team_All]![sfrm_Status].Form.Requery
'Me.Refresh

Else

End If
'***************************************
 
D

David

I found this helpful bit of code from Albert D. Kallal that seems to work.

Dim lngPos As Integer

lngPos = Me.Recordset.AbsolutePosition
Me.Requery
Me.Recordset.AbsolutePosition = lngPos
 

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