How to get Pop to Sync with Main

D

doyle60

I'm trying to get a pop up to sync with a main form. I've done this
plenty of times but can't figure out why this one isn't working.

The main form link is a control called

VTISelected

and has in it's control source

=[QualityBNPOsub2WithVTI].[Form]![VTIID]

So you see the link between the main form and the pop is going through
a sub on the main. The control is choosing the first record.

So I tried this code:

If IsOpen("VTIHeaderfrmForQPop") Then
Forms!VTIHeaderfrmForQPop.Filter = "VTIID = " & Nz(Me!VTISelected,
-1)
End If

Which is the format that works for me.

I tried to refer to the sub directly with this code:

If IsOpen("VTIHeaderfrmForQPop") Then
Forms!VTIHeaderfrmForQPop.Filter = "VTIID = " & Nz
([QualityBNPOsub2WithVTI].[Form]![VTIID], -1)
End If

But this doesn't work either.

What am I doing wrong? Is it impossible to sync with an indirect
field, one that isn't truly on the main?

Thanks,

Matt
 
D

Dale_Fye via AccessMonster.com

Where did you put this code?

What is causing the popup for to open?

I think I would probably check to see whether VTIID is null before I open the
popup. If it is not null, then you should create your critieria before you
open the popup and use the WhereCondition argument of the OpenForm method to
restrict that form to synch with the main form. Something like:

Private Sub someEvent

Dim strCriteria as string

if isnull([QualityBNPOsub2WithVTI].[Form]![VTIID]) = True then
'what do you want to do if VTIID is null
Else
strCriteria = "[VTIID] = " [QualityBNPOsub2WithVTI].[Form]![VTIID]
docmd.OpenForm "VTIHeaderfrmForQPop",,,strCriteria, , acDialog
End If

End Sub


HTH
Dale

I'm trying to get a pop up to sync with a main form. I've done this
plenty of times but can't figure out why this one isn't working.

The main form link is a control called

VTISelected

and has in it's control source

=[QualityBNPOsub2WithVTI].[Form]![VTIID]

So you see the link between the main form and the pop is going through
a sub on the main. The control is choosing the first record.

So I tried this code:

If IsOpen("VTIHeaderfrmForQPop") Then
Forms!VTIHeaderfrmForQPop.Filter = "VTIID = " & Nz(Me!VTISelected,
-1)
End If

Which is the format that works for me.

I tried to refer to the sub directly with this code:

If IsOpen("VTIHeaderfrmForQPop") Then
Forms!VTIHeaderfrmForQPop.Filter = "VTIID = " & Nz
([QualityBNPOsub2WithVTI].[Form]![VTIID], -1)
End If

But this doesn't work either.

What am I doing wrong? Is it impossible to sync with an indirect
field, one that isn't truly on the main?

Thanks,

Matt
 

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