dbTalk Databases Forums  

Can a Pop-Up Window control another opened window?

comp.databases.ms-access comp.databases.ms-access


Discuss Can a Pop-Up Window control another opened window? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Susan Bricker
 
Posts: n/a

Default Can a Pop-Up Window control another opened window? - 01-21-2008 , 08:25 AM






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 ***

Reply With Quote
  #2  
Old   
Geo
 
Posts: n/a

Default Re: Can a Pop-Up Window control another opened window? - 01-21-2008 , 08:47 AM






On 21 Jan 2008 14:25:36 GMT, Susan Bricker <slbrick (AT) verizon (DOT) net> wrote:


Quote:
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


Reply With Quote
  #3  
Old   
Keith Wilby
 
Posts: n/a

Default Re: Can a Pop-Up Window control another opened window? - 01-21-2008 , 09:25 AM



"Susan Bricker" <slbrick (AT) verizon (DOT) net> wrote

Quote:
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



Reply With Quote
  #4  
Old   
Susan Bricker
 
Posts: n/a

Default Re: Can a Pop-Up Window control another opened window? - 01-22-2008 , 12:28 PM



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 ***

Reply With Quote
  #5  
Old   
SueB
 
Posts: n/a

Default Re: Can a Pop-Up Window control another opened window? - 01-22-2008 , 01:08 PM



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 ***

Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: Can a Pop-Up Window control another opened window? - 01-22-2008 , 01:29 PM



SueB wrote:
Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.