how to requery mainform from popupform? (1 Viewer)

wcoast

Registered User.
Local time
Today, 07:05
Joined
Jul 9, 2006
Messages
27
Hi!

I have a mainform, with a popupform, on which I want to select a record/post
to work with on the mainform. I have managed to select the actual post on the popup, but i dont know how to make the mainform navigate to that form.


How do I easiest accomplish to make the mainform navigate to the record I've selected on the popupform?

thanks for your reply ;)
 

TedMartin

Registered User.
Local time
Today, 07:05
Joined
Sep 29, 2003
Messages
76
Probably several ways but one way I use would be close the main form as the Pop Up opens, select the record and as this is done, make the record = to a public variable and the re-open the main form but filter it using the variable.

Put the Public Variable in a Module with this code at the top

Option Compare Database
Public strIDRef As String

For example:

Private Sub ID_Ref_DblClick(Cancel As Integer)
strJobRef = [ID_Ref].Value
DoCmd.OpenForm "F-Your Main Form", , , "[ID_Ref] = '" & strIDRef & "'"
DoCmd.Close acForm, "F-Your Pop-Up"
End Sub

If the Record Id is an Integer rather than a string, let me know and I'll revise the filter
 

wcoast

Registered User.
Local time
Today, 07:05
Joined
Jul 9, 2006
Messages
27
Yes, the recordID is an Integer

TedMartin said:
Probably several ways but one way I use would be close the main form as the Pop Up opens, select the record and as this is done, make the record = to a public variable and the re-open the main form but filter it using the variable.

Put the Public Variable in a Module with this code at the top

Option Compare Database
Public strIDRef As String

For example:

Private Sub ID_Ref_DblClick(Cancel As Integer)
strJobRef = [ID_Ref].Value
DoCmd.OpenForm "F-Your Main Form", , , "[ID_Ref] = '" & strIDRef & "'"
DoCmd.Close acForm, "F-Your Pop-Up"
End Sub

If the Record Id is an Integer rather than a string, let me know and I'll revise the filter


Yeah, the recordID is an Integer. It would be very nice if you have time revising the example code. Thanks :)
 

TedMartin

Registered User.
Local time
Today, 07:05
Joined
Sep 29, 2003
Messages
76
So the Public Variable needs to be Public intIDref as integer and the Filter line needs to be
DoCmd.OpenForm "F-Your Main Form", , , "[ID_Ref] = " & intIDRef
 

Users who are viewing this thread

Top Bottom