.Bookmark = .RecordsetClone.Bookmark

R

redFred

I am at a loss. I have a button on a subform (continuous) to select a record
to display on another subform, which has some onCurrent events. This works
just fine but does take a few seconds and I wish to display a please wait
label on the parent of the subform that houses the button.

The label is visible, I have ensured that. When user selects the button to
display a record, the label should be visible but is not. When I step
through it is made visible correctly, but the net effect for user is that the
label is never visible.

Code:
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

Anything I try works (when in debug) but in real time nothing happens as it
appears the .bookmark= function takes over.

Does anyone have advice?

Thanks.
 
K

Ken Snell \(MVP\)

The issue is that you are not setting focus to the new form so that it
becomes "visible" to the user while the rest of the code runs.

But, try a DoEvents to let the PC have some time to catch up:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus


If that is not successful, you may want to add a Repaint action too:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
Forms![frm1 Client]!Reservationfrm.Form.Repaint
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus


And if the above are not successful, this should do the trick:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
Forms![frm1 Client]![Reservationfrm].SetFocus
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

--

Ken Snell
<MS ACCESS MVP>



redFred said:
I am at a loss. I have a button on a subform (continuous) to select a
record
to display on another subform, which has some onCurrent events. This
works
just fine but does take a few seconds and I wish to display a please wait
label on the parent of the subform that houses the button.

The label is visible, I have ensured that. When user selects the button
to
display a record, the label should be visible but is not. When I step
through it is made visible correctly, but the net effect for user is that
the
label is never visible.

Code:
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible =
True
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible =
False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

Anything I try works (when in debug) but in real time nothing happens as
it
appears the .bookmark= function takes over.

Does anyone have advice?

Thanks.
 
R

redFred

Way kewl, Ken.

I tried the first one and it worked! The setfocus I was missing made sense,
but I will take what you gave me. Has other apps for me, too.

Thanks for the help.

Ken Snell (MVP) said:
The issue is that you are not setting focus to the new form so that it
becomes "visible" to the user while the rest of the code runs.

But, try a DoEvents to let the PC have some time to catch up:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus


If that is not successful, you may want to add a Repaint action too:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
Forms![frm1 Client]!Reservationfrm.Form.Repaint
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus


And if the above are not successful, this should do the trick:

Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
Forms![frm1 Client]![Reservationfrm].SetFocus
DoEvents
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

--

Ken Snell
<MS ACCESS MVP>



redFred said:
I am at a loss. I have a button on a subform (continuous) to select a
record
to display on another subform, which has some onCurrent events. This
works
just fine but does take a few seconds and I wish to display a please wait
label on the parent of the subform that houses the button.

The label is visible, I have ensured that. When user selects the button
to
display a record, the label should be visible but is not. When I step
through it is made visible correctly, but the net effect for user is that
the
label is never visible.

Code:
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible =
True
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible =
False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

Anything I try works (when in debug) but in real time nothing happens as
it
appears the .bookmark= function takes over.

Does anyone have advice?

Thanks.
 
M

Marshall Barton

redFred said:
I am at a loss. I have a button on a subform (continuous) to select a record
to display on another subform, which has some onCurrent events. This works
just fine but does take a few seconds and I wish to display a please wait
label on the parent of the subform that houses the button.

The label is visible, I have ensured that. When user selects the button to
display a record, the label should be visible but is not. When I step
through it is made visible correctly, but the net effect for user is that the
label is never visible.

Code:
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = True
With Forms![frm1 Client]![Reservationfrm].Form![Jobfrm].Form
.RecordsetClone.FindFirst "InvNum = " & Me!txtInvNum
If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With
Forms![frm1 Client]!Reservationfrm.Form!lblPleaseWaitInvoice.Visible = False
Forms![frm1 Client]![Reservationfrm].Form![tabJob].SetFocus

Anything I try works (when in debug) but in real time nothing happens as it
appears the .bookmark= function takes over.


Try adding:

Me.Repaint
and/or
DoEvents
 

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

Similar Threads

Subform: record select form other subform 23
set focus 2
Blank subform 0
Vis/Invis SetFocus conundrum 2
Can't assign value 1
record vanishes on acNewRec 4
Subform goes blank 1
setting focus to 3rd subform 20

Top