returning to matched id upon closing a form (1 Viewer)

S

segorese

Guest
In the following code 1), a command button
on the main form (PLF Main) opens a secondary
form (PBII Information Form) based on a
matched indentifier (PIN) where PIN in the
main form = PIN # in the PBII form.

The code in 1) works as it should and
the match appears. But when trying
to return to the PLF Main Form
( (2) named GotoVFCForm ) from the
secondary form on the matched value, the
link between PINs does not hold and
the main form resets to the first record
even though the stLinkCriteria seems
established as in the first Sub.

Can anyone suggest why they do not work
consistently? Pardon the extraneous code
and notes. These are just quick suggestions from programmers here who can't help with
this problem.

Thank you for your time. This has been a great service to me!

Steve Segore
Albany, NY, USA
'------------------------------------------------------------
' OpenPBII
'(opens pbii information form and is blank if there PIN doesn't match
'------------------------------------------------------------

1)
Private Sub OpenPBII_Click()
On Error GoTo Err_OpenPBII_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PBII Information Form"
stLinkCriteria = "[PIN #]=" & "'" & Me![PIN#] & "'"

Application.Echo False
DoCmd.Hourglass True
DoCmd.Close acForm, "PLF Main"
' 2/00 would ideally like to amend code here to
'open the pbii form in hidden mode
'if there is pbii information, show form, if not,
'warns user that there is no matching pbii information
'and close pbii form

DoCmd.OpenForm stDocName, , , stLinkCriteria
'DoCmd.Maximize
Call mdl_warn_if_no_match_pbii
Application.Echo True
DoCmd.Hourglass False

Exit_OpenPBII_Click:
Exit Sub

Err_OpenPBII_Click:
Application.Echo True
DoCmd.Hourglass False
MsgBox Err.Description
Resume Exit_OpenPBII_Click


End Sub
***********

2)

Private Sub GoToVFCForm_Click()
On Error GoTo Err_GoToVFCForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PLF Main"

stLinkCriteria = "[PIN]=" & "'" & Me![PIN #] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_GoToVFCForm_Click:
Exit Sub

Err_GoToVFCForm_Click:
MsgBox Err.Description
Resume Exit_GoToVFCForm_Click

End Sub
 

Users who are viewing this thread

Top Bottom