Pop up forms

F

Fysh

Has anyone one ran into to this and know a way of solving
it? I posted yesterday but didn't get a response.
However, I believe I narrowed it down.

I have a main form with a combo box to select the
customer. This form has several hidden fields until the
field is updated. On this form I have a subform when a
button is selected from the main form it shows different
training requirements. On the subform are several items
which each one has a button/link to open a pop-up form to
show the details of that particular training requirement
and scores are selected. When the pop-up is closed I have
it requery the subform, requery the main form, then set
the bookmark to the subform link. Now this was working
fine and I continued developing and I couldn't figure out
why all of a sudden I kept getting an error about the
bookmark and the main form changed to the first record
each time. Well after tracing my steps I realize I set
the pop-up form to Pop Up to yes. I haven't figured out
why this would stop the code from working, but I reset it
to no and the code works.

Does anyone have a clue of why this happens and how to
solve it. Any thoughts would be aprreciated, time crunch
here. Thanks
 
M

MacDermott

Thanks for the more extensive explanation.
Could you post the code you're using to do the requeries, and tell us
whether this code is located behind the main form, subform, or popup?
 
F

Fysh

There is more code, but this is how the forms talk to each
other. Any idea how I keep the size of the forms without
them maximizing? Pop Up set to yes causes the bookmark
not to work for some reason. Thanks

Main Form
Private Sub Form_Activate()
If IsNull(Me![Combo44]) = False Then
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PracticalIDNumber] = " & str(Me!
[Combo44])
Me.Bookmark = rs.Bookmark
End If
End Sub

on current
me.refresh

Sub Form

Private Sub Attribute_Click()
SetBookmark (Me.Bookmark)
DoCmd.OpenForm "frmDetails", acNormal
End Sub

on current
me.refresh

Pop Up On Close

Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Requery
Forms![frmEnterDataNonDetailed].Requery
Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Bookmark =
strBookmark
 
M

MacDermott

Where does the value of strBookmark in the last procedure come from?
BTW, bookmarks are usually stored in Variant type variables, rather than
in strings.

Fysh said:
There is more code, but this is how the forms talk to each
other. Any idea how I keep the size of the forms without
them maximizing? Pop Up set to yes causes the bookmark
not to work for some reason. Thanks

Main Form
Private Sub Form_Activate()
If IsNull(Me![Combo44]) = False Then
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PracticalIDNumber] = " & str(Me!
[Combo44])
Me.Bookmark = rs.Bookmark
End If
End Sub

on current
me.refresh

Sub Form

Private Sub Attribute_Click()
SetBookmark (Me.Bookmark)
DoCmd.OpenForm "frmDetails", acNormal
End Sub

on current
me.refresh

Pop Up On Close

Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Requery
Forms![frmEnterDataNonDetailed].Requery
Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Bookmark =
strBookmark

-----Original Message-----
Thanks for the more extensive explanation.
Could you post the code you're using to do the requeries, and tell us
whether this code is located behind the main form, subform, or popup?




.
 
G

Guest

The strBookmark is a function from a module so I can use it several times
throughout the program. Here is the code.

Option Compare Database
Option Explicit

Public strBookmark As String

Function SetBookmark(strBkmk As String) As Boolean

strBookmark = strBkmk
'MsgBox strBookmark

End Function


MacDermott said:
Where does the value of strBookmark in the last procedure come from?
BTW, bookmarks are usually stored in Variant type variables, rather than
in strings.

Fysh said:
There is more code, but this is how the forms talk to each
other. Any idea how I keep the size of the forms without
them maximizing? Pop Up set to yes causes the bookmark
not to work for some reason. Thanks

Main Form
Private Sub Form_Activate()
If IsNull(Me![Combo44]) = False Then
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PracticalIDNumber] = " & str(Me!
[Combo44])
Me.Bookmark = rs.Bookmark
End If
End Sub

on current
me.refresh

Sub Form

Private Sub Attribute_Click()
SetBookmark (Me.Bookmark)
DoCmd.OpenForm "frmDetails", acNormal
End Sub

on current
me.refresh

Pop Up On Close

Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Requery
Forms![frmEnterDataNonDetailed].Requery
Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Bookmark =
strBookmark

-----Original Message-----
Thanks for the more extensive explanation.
Could you post the code you're using to do the requeries, and tell us
whether this code is located behind the main form, subform, or popup?

Has anyone one ran into to this and know a way of solving
it? I posted yesterday but didn't get a response.
However, I believe I narrowed it down.

I have a main form with a combo box to select the
customer. This form has several hidden fields until the
field is updated. On this form I have a subform when a
button is selected from the main form it shows different
training requirements. On the subform are several items
which each one has a button/link to open a pop-up form to
show the details of that particular training requirement
and scores are selected. When the pop-up is closed I have
it requery the subform, requery the main form, then set
the bookmark to the subform link. Now this was working
fine and I continued developing and I couldn't figure out
why all of a sudden I kept getting an error about the
bookmark and the main form changed to the first record
each time. Well after tracing my steps I realize I set
the pop-up form to Pop Up to yes. I haven't figured out
why this would stop the code from working, but I reset it
to no and the code works.

Does anyone have a clue of why this happens and how to
solve it. Any thoughts would be aprreciated, time crunch
here. Thanks


.
 
M

MacDermott

I've just been playing around a little in Access myself;
closing a pop-up form does not cause the Activate event of the
underlying form to fire.
(in a way, this makes sense, because the other form can be active, even
when the pop-up form is showing. If you want to prevent the user from doing
anything on the main form while the pop-up is displayed, you should make the
pop-up form also modal. But even this won't make the Activate event fire -
I just tried.)

You may want to execute the code in the Form_Activate procedure explicitly
from the Close event of the pop-up form.
If you really only need that code to run when you close the pop-up form,
you could change the Me. references to refer explicitly to the main form
(Forms![frmEnterDataNonDetailed]...) and paste it into the Close event.
If you need it to run at other times the form is activated, you could
change the declaration of Form_Activate() from Private to Public and call it
from the Close event:
Form_frmEnterDataNonDetailed.Form_Activate()

HTH
- Turtle





Fysh said:
The strBookmark is a function from a module so I can use it several times
throughout the program. Here is the code.

Option Compare Database
Option Explicit

Public strBookmark As String

Function SetBookmark(strBkmk As String) As Boolean

strBookmark = strBkmk
'MsgBox strBookmark

End Function


MacDermott said:
Where does the value of strBookmark in the last procedure come from?
BTW, bookmarks are usually stored in Variant type variables, rather than
in strings.

Fysh said:
There is more code, but this is how the forms talk to each
other. Any idea how I keep the size of the forms without
them maximizing? Pop Up set to yes causes the bookmark
not to work for some reason. Thanks

Main Form
Private Sub Form_Activate()
If IsNull(Me![Combo44]) = False Then
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PracticalIDNumber] = " & str(Me!
[Combo44])
Me.Bookmark = rs.Bookmark
End If
End Sub

on current
me.refresh

Sub Form

Private Sub Attribute_Click()
SetBookmark (Me.Bookmark)
DoCmd.OpenForm "frmDetails", acNormal
End Sub

on current
me.refresh

Pop Up On Close

Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Requery
Forms![frmEnterDataNonDetailed].Requery
Forms![frmEnterDataNonDetailed]!
[frmEnterDataNonDetailedSubform].Form.Bookmark =
strBookmark


-----Original Message-----
Thanks for the more extensive explanation.
Could you post the code you're using to do the requeries,
and tell us
whether this code is located behind the main form,
subform, or popup?

message
Has anyone one ran into to this and know a way of
solving
it? I posted yesterday but didn't get a response.
However, I believe I narrowed it down.

I have a main form with a combo box to select the
customer. This form has several hidden fields until the
field is updated. On this form I have a subform when a
button is selected from the main form it shows different
training requirements. On the subform are several items
which each one has a button/link to open a pop-up form
to
show the details of that particular training requirement
and scores are selected. When the pop-up is closed I
have
it requery the subform, requery the main form, then set
the bookmark to the subform link. Now this was working
fine and I continued developing and I couldn't figure
out
why all of a sudden I kept getting an error about the
bookmark and the main form changed to the first record
each time. Well after tracing my steps I realize I set
the pop-up form to Pop Up to yes. I haven't figured out
why this would stop the code from working, but I reset
it
to no and the code works.

Does anyone have a clue of why this happens and how to
solve it. Any thoughts would be aprreciated, time
crunch
here. Thanks


.
 

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