Keep focus on record

G

Gary Dolliver

Hi all,
I have a main form [orders] and a nested form [items] - depending on the
order type, a different [items] form will appear - this can vary from order
to order, but within an order, the [items] form will always be the same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the orders
form), it performs a refresh on the screen to have the note appear, but then
the items form is reset to record number 1 - is there a way to keep the focus
on the current item record within the items form so it would stay on record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 
E

Evi

1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the Other
tab)

Evi
 
G

Gary Dolliver

Thanks for the reply, unfortunately, this cannot work as when I close the
notes form, it performs a "refresh" on the orders form (this allows the note
to appear under the note tab immediately - a request from a while ago) and
thus resests the items form back to record number 1 - I guess I will have to
figure out which one is more important to have! unless you have any other
suggestions? thanks again
-gary

Evi said:
1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the Other
tab)

Evi

Gary Dolliver said:
Hi all,
I have a main form [orders] and a nested form [items] - depending on the
order type, a different [items] form will appear - this can vary from order
to order, but within an order, the [items] form will always be the same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the orders
form), it performs a refresh on the screen to have the note appear, but then
the items form is reset to record number 1 - is there a way to keep the focus
on the current item record within the items form so it would stay on record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 
E

Evi

You shouldn't need the Refresh code if you are using a Dialog form but if
that doesnt' do the trick, how about simply requerying the Note field rather
than the whole form

Me.YourNoteField.Requery

Evi
Gary Dolliver said:
Thanks for the reply, unfortunately, this cannot work as when I close the
notes form, it performs a "refresh" on the orders form (this allows the note
to appear under the note tab immediately - a request from a while ago) and
thus resests the items form back to record number 1 - I guess I will have to
figure out which one is more important to have! unless you have any other
suggestions? thanks again
-gary

Evi said:
1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the Other
tab)

Evi

Hi all,
I have a main form [orders] and a nested form [items] - depending on the
order type, a different [items] form will appear - this can vary from order
to order, but within an order, the [items] form will always be the same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the orders
form), it performs a refresh on the screen to have the note appear,
but
then
the items form is reset to record number 1 - is there a way to keep
the
focus
on the current item record within the items form so it would stay on record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 
G

Gary Dolliver

Hi there,
well, the notes are also in a sub form on another tab. I tried disabling
the refresh, to rely on the acDialog, but the subform is now not updating.
When the note form is closed, it calls forms("orders").refresh - I tried
changing to the notes subform, but I keep getting errors ????
-gary

Evi said:
You shouldn't need the Refresh code if you are using a Dialog form but if
that doesnt' do the trick, how about simply requerying the Note field rather
than the whole form

Me.YourNoteField.Requery

Evi
Gary Dolliver said:
Thanks for the reply, unfortunately, this cannot work as when I close the
notes form, it performs a "refresh" on the orders form (this allows the note
to appear under the note tab immediately - a request from a while ago) and
thus resests the items form back to record number 1 - I guess I will have to
figure out which one is more important to have! unless you have any other
suggestions? thanks again
-gary

Evi said:
1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the Other
tab)

Evi

Hi all,
I have a main form [orders] and a nested form [items] - depending on the
order type, a different [items] form will appear - this can vary from
order
to order, but within an order, the [items] form will always be the same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the orders
form), it performs a refresh on the screen to have the note appear, but
then
the items form is reset to record number 1 - is there a way to keep the
focus
on the current item record within the items form so it would stay on
record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 
E

Evi

To save a record, you can use
If Me.Dirty = True Then
Me.Dirty = False
End If


If the control you want to requery is in a different subform, then the way
to requery it is

Me.Parent.TheNameOfYourSubform.Form.TheNameOfYourSubformControl.Requery

Note that the name of the Subform *control* (as opposed to the subform name
that appears in the database window, is that which appears when you click
on the subform in the main form's design view, go to Properties, click on
the Other tab and look at Name. It may not be the same. (I usually rename
my subform *control* if necessary, in Properties to same name as it has in
the database window)

Evi


Gary Dolliver said:
Hi there,
well, the notes are also in a sub form on another tab. I tried disabling
the refresh, to rely on the acDialog, but the subform is now not updating.
When the note form is closed, it calls forms("orders").refresh - I tried
changing to the notes subform, but I keep getting errors ????
-gary

Evi said:
You shouldn't need the Refresh code if you are using a Dialog form but if
that doesnt' do the trick, how about simply requerying the Note field rather
than the whole form

Me.YourNoteField.Requery

Evi
Thanks for the reply, unfortunately, this cannot work as when I close the
notes form, it performs a "refresh" on the orders form (this allows
the
note
to appear under the note tab immediately - a request from a while ago) and
thus resests the items form back to record number 1 - I guess I will
have
to
figure out which one is more important to have! unless you have any other
suggestions? thanks again
-gary

:

1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the Other
tab)

Evi

Hi all,
I have a main form [orders] and a nested form [items] - depending
on
the
order type, a different [items] form will appear - this can vary from
order
to order, but within an order, the [items] form will always be the same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the orders
form), it performs a refresh on the screen to have the note
appear,
but
then
the items form is reset to record number 1 - is there a way to
keep
the
focus
on the current item record within the items form so it would stay on
record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 
G

Gary Dolliver

thank you so much, through some editing, I was able to get it to work with
[Forms]![orders].[sub_notes].Form.Requery

thank you so much!!
-gary

Evi said:
To save a record, you can use
If Me.Dirty = True Then
Me.Dirty = False
End If


If the control you want to requery is in a different subform, then the way
to requery it is

Me.Parent.TheNameOfYourSubform.Form.TheNameOfYourSubformControl.Requery

Note that the name of the Subform *control* (as opposed to the subform name
that appears in the database window, is that which appears when you click
on the subform in the main form's design view, go to Properties, click on
the Other tab and look at Name. It may not be the same. (I usually rename
my subform *control* if necessary, in Properties to same name as it has in
the database window)

Evi


Gary Dolliver said:
Hi there,
well, the notes are also in a sub form on another tab. I tried disabling
the refresh, to rely on the acDialog, but the subform is now not updating.
When the note form is closed, it calls forms("orders").refresh - I tried
changing to the notes subform, but I keep getting errors ????
-gary

Evi said:
You shouldn't need the Refresh code if you are using a Dialog form but if
that doesnt' do the trick, how about simply requerying the Note field rather
than the whole form

Me.YourNoteField.Requery

Evi
Thanks for the reply, unfortunately, this cannot work as when I close the
notes form, it performs a "refresh" on the orders form (this allows the
note
to appear under the note tab immediately - a request from a while ago) and
thus resests the items form back to record number 1 - I guess I will have
to
figure out which one is more important to have! unless you have any other
suggestions? thanks again
-gary

:

1. when you open the form to insert your note, open it as a Dialog form.
DoCmd.OpenForm "YourForm", , , AnyCriteria, , acDialog

If appropriate make your popup a Modal form using Properties (on the
Other
tab)

Evi

message
Hi all,
I have a main form [orders] and a nested form [items] - depending on
the
order type, a different [items] form will appear - this can vary from
order
to order, but within an order, the [items] form will always be the
same.
Also, there may be multiple item records within one order.
The problem I am having is when I make a note (by a button on the
orders
form), it performs a refresh on the screen to have the note appear,
but
then
the items form is reset to record number 1 - is there a way to keep
the
focus
on the current item record within the items form so it would stay on
record
number "x" instead of going back to 1?
help is always appreciated, thanks!
-gary
 

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