Can a Pop-Up Window control another opened window?

Can a Pop-Up Window control another opened window?

am 21.01.2008 15:25:36 von Susan Bricker

I have a window with a subform that has a subform. The main (outter)
window is a single form that enables navigation through the recordset
via buttons (btnFirst,btnPrevious,btnNext,btnLast). I would normally
put an unbound combobox at the top to enable the user to "jump" to a
particular record by selecting one of the rows in the combobox. However
the window seems a bit full and I really don't want to change the design
of that window.

However, there is room for a command button that I thought could be used
to open pop-up window with a combobox to be use to "find/jump" to a
particular record in the original outter window (at the
combobox.AfterUpdate event).

However, I haven't figured out how to "tell" the calling window what to
do. Since I intended to keep the outter window open and visible while
the pop-up window is displayed I can't use the docmd.openform method to
pass the recordID back to the calling form.

Any suggestions?

ALSO ... Am I supposed to be notified via EMAIL when someone answers my
post here on Developersdex? I am not receiving notifications. Would
you know why?

Thanks.
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Can a Pop-Up Window control another opened window?

am 21.01.2008 15:47:13 von Geo

On 21 Jan 2008 14:25:36 GMT, Susan Bricker wrote:


>ALSO ... Am I supposed to be notified via EMAIL when someone answers my
>post here on Developersdex? I am not receiving notifications. Would
>you know why?
Sorry I cannot help with your main question but you are actually posting to a
USENET newsgroup - comp.databases.ms-access. You are responsible for retrieving
any answers with your newsreader client. Presumably Developersdex is some sort
of website that makes out that USENET is its personal property.
regards,

Geo

Re: Can a Pop-Up Window control another opened window?

am 21.01.2008 16:25:55 von Jebusville

"Susan Bricker" wrote in message
news:4794ab5f$0$3581$815e3792@news.qwest.net...
>I have a window with a subform that has a subform. The main (outter)
> window is a single form that enables navigation through the recordset
> via buttons (btnFirst,btnPrevious,btnNext,btnLast). I would normally
> put an unbound combobox at the top to enable the user to "jump" to a
> particular record by selecting one of the rows in the combobox. However
> the window seems a bit full and I really don't want to change the design
> of that window.
>
> However, there is room for a command button that I thought could be used
> to open pop-up window with a combobox to be use to "find/jump" to a
> particular record in the original outter window (at the
> combobox.AfterUpdate event).
>
> However, I haven't figured out how to "tell" the calling window what to
> do. Since I intended to keep the outter window open and visible while
> the pop-up window is displayed I can't use the docmd.openform method to
> pass the recordID back to the calling form.
>

There may be a better way but you could try opening the filter form *hidden*
at the same time as the main form opens. Your button could then unhide the
filter form, you could then select the criteria and the "go" button hides it
again (so it never actually closes). You could then refer to the filter
form in code on the main form.

Worth a try.

Keith.
www.keithwilby.com

Re: Can a Pop-Up Window control another opened window?

am 22.01.2008 19:28:17 von Susan Bricker

It's me again. I'm still struggling with this idea of mine ... to use a
pop-up window with a combobox from which a user may select a record to
be displayed on a different (opened) window.

Is this possible?

I defined a global variable and put the record ID in it (when processing
the combobox OnUpdate event.

Then when the pop-up window closes I thought that I'd hit one of the
Form's events (perhaps the OnCurrent, GotFocus, or one of the other
events). The plan was to then take the value from the global variable
and use that to move the record set to that record (thus displaying the
selected record and populating the subforms, as well).

Unfortunately, I am not hitting any Form event when the pop-up window
closes. Obviously, my knowledge of event-driven code is limited.

Anybody want to take a stab at this one?

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Can a Pop-Up Window control another opened window?

am 22.01.2008 20:08:20 von Susan Bricker

Well, I have it working. Perhaps a bit inelegant, but working. In case
anybody out there is reading and wants to know how I did it and perhaps
wants to make a critique ...

1. Initial form: frmEvents
2. Click on btn to open popup: btnFindEvent
3. frmFindEvent has the following functions:

Option Compare Database
Option Explicit

Private Sub cboEvents_AfterUpdate()
On Error GoTo Err_cboEvents_AfterUpdate

lngJumpToRec = Me!cboEvents 'global variable
DoCmd.Close
Forms("frmEvents")!btnFirst.SetFocus 'change focus in Events display
window

Exit_cboEvents_AfterUpdate:
Exit Sub

Err_cboEvents_AfterUpdate:
If Err.Number <> 2110 Then 'disregard this error
Call ShowError("frmFindEvent", "cboEvents_AfterUpdate",
Err.Number, Err.Description)
End If
Resume Exit_cboEvents_AfterUpdate

End Sub

Private Sub Form_Open(Cancel As Integer)
'Open form where I want it to open on the screen
DoCmd.MoveSize 1440 * 2.95, 1440 * 8.25
End Sub


4. When btnFirst gets focus in the Events Display screen (frmEvents) it
does the following to repoint the recordset to the desired record:

Private Sub btnFirst_GotFocus()
On Error GoTo Err_btnFirst_GotFocus

Dim db As DAO.Database
Dim rst As DAO.Recordset

If lngJumpToRec > 0 Then
'Force all records to load
Me.RecordsetClone.MoveLast

'Position current record to the record w/ the input record ID
Set db = CurrentDb
Set rst = Me.RecordsetClone
rst.FindFirst "[eventID] = " & lngJumpToRec
Me.Bookmark = rst.Bookmark

rst.Close
Set rst = Nothing
Set db = Nothing

lngJumpToRec = 0 'reset global variable
End If

Exit_btnFirst_GotFocus:
Exit Sub

Err_btnFirst_GotFocus:
Call ShowError("frmEvents", "btnFirst_GotFocus", Err.Number,
Err.Description)
Resume Exit_btnFirst_GotFocus

End Sub

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Can a Pop-Up Window control another opened window?

am 22.01.2008 20:29:52 von Salad

SueB wrote:
> Well, I have it working. Perhaps a bit inelegant, but working. In case
> anybody out there is reading and wants to know how I did it and perhaps
> wants to make a critique ...
>
> 1. Initial form: frmEvents
> 2. Click on btn to open popup: btnFindEvent
> 3. frmFindEvent has the following functions:
>
> Option Compare Database
> Option Explicit
>
> Private Sub cboEvents_AfterUpdate()
> On Error GoTo Err_cboEvents_AfterUpdate
>
> lngJumpToRec = Me!cboEvents 'global variable
> DoCmd.Close
> Forms("frmEvents")!btnFirst.SetFocus 'change focus in Events display
> window
>
> Exit_cboEvents_AfterUpdate:
> Exit Sub
>
> Err_cboEvents_AfterUpdate:
> If Err.Number <> 2110 Then 'disregard this error
> Call ShowError("frmFindEvent", "cboEvents_AfterUpdate",
> Err.Number, Err.Description)
> End If
> Resume Exit_cboEvents_AfterUpdate
>
> End Sub
>
> Private Sub Form_Open(Cancel As Integer)
> 'Open form where I want it to open on the screen
> DoCmd.MoveSize 1440 * 2.95, 1440 * 8.25
> End Sub
>
>
> 4. When btnFirst gets focus in the Events Display screen (frmEvents) it
> does the following to repoint the recordset to the desired record:
>
> Private Sub btnFirst_GotFocus()
> On Error GoTo Err_btnFirst_GotFocus
>
> Dim db As DAO.Database
> Dim rst As DAO.Recordset
>
> If lngJumpToRec > 0 Then
> 'Force all records to load
> Me.RecordsetClone.MoveLast
>
> 'Position current record to the record w/ the input record ID
> Set db = CurrentDb
> Set rst = Me.RecordsetClone
> rst.FindFirst "[eventID] = " & lngJumpToRec
> Me.Bookmark = rst.Bookmark
>
> rst.Close
> Set rst = Nothing
> Set db = Nothing
>
> lngJumpToRec = 0 'reset global variable
> End If
>
> Exit_btnFirst_GotFocus:
> Exit Sub
>
> Err_btnFirst_GotFocus:
> Call ShowError("frmEvents", "btnFirst_GotFocus", Err.Number,
> Err.Description)
> Resume Exit_btnFirst_GotFocus
>
> End Sub
>
> Regards,
> SueB
>
> *** Sent via Developersdex http://www.developersdex.com ***

You could open the form as a dialog.
Docmd.OpenForm "SearchForm",,,,,acDialog
and this will pause the execution of following code until focus is
returned by closing the form or making the the form hidden.

Let's say you have a combo box with Select and Cancel command buttons in
the search form.
Private Sub CommandSelect_OnClick
Me.Visible = False
End Sub
Private Sub CommandCancel_OnClick
Docmd.Close acForm, Me.Name
End Sub

So in the calling form you might have
Dim rst As Recordset
Docmd.OpenForm "SearchForm",,,,,acDialog
If IsLoaded("SearchForm") Then
'see google for IsLoaded() function
Set rst = Me.RecordsetClone
rst.FindFirst "Id = " & Forms!Searchform!ComboBoxName
Me.BookMark = rst.BookMark
Docmd.Close acForm,"SearcdhForm"
rst.close
Endif
set rst = Nothing

Jam
http://www.youtube.com/watch?v=LlmIl70lwW0