Refresh after new record added

  • Thread starter Thread starter aMack
  • Start date Start date
A

aMack

have created an input form for new records from our main production form.

The main form does not refresh after the new record is added.

I have to exit and reopen to see the new record.

Where can I put a Refresh command to show the new record immediately?


We tried Refresh and Requery on the "AfterUpdate" event of the Input form
but it did not work like I had thought.

Thanks
 
That's strange because when you add a record in normal mode you would see it
immediately. How is your form setup? Are you using a savebutton or something
like that or is your form in data-entry mode perhaps.
 
The Input form and the new record number is generated thorugh a Macro:

Openquery
RunCommand - Copy
Close - Query
OpenForm - "Transload New"
GoToRecord - New
GoToControl - REF#
RunCommand - Paste


I am sure there is an easier way to do this??
 
Yep, there is a better way to do this but that depends on your db. I don't
know how this is setup. Looking at your macro the record is pasted into the
recordsource of the form.

The routine could be:

Open the form from a specific point or after an action taken with the
following parameter: DoCmd.OpenForm , acNormal, , , acFormAdd

This option will take you to a new record on the specific form.
The way I see it there's something else going on in your db. The macro
states it has to copy and paste a record into the recordsource. In that case
what is it what you expect? Do you expect to see the added record as the last
record or do you expect it to get focus on that record. If your form is based
on a table it might not be the last record but somewhere in between the other
records e.g the table isn't sorted.

so try to elaborate a little more on the situation of your db so we can
figure out how to solve this for you.
 
The table is sorted by the [REF#] and a new record is MAX[REF#]+1.

The reason I am using a sperate form to add a new record is that users have
had a tendancy to change key fields like [Customer Name] by mistake without
knowing it - I made the key fields like [Customer Name] locked on the main
form which means I can't just add a new record since the key fields can't be
blank and if they are locked the user can't change them on the new record.

???
 
So you are using some sort of backup table which you append from by copying
and pasting the record right? I my opinion you could use a regular append
query for that. Although I must admit that you should reconsider the setup of
your original form. Data being changed by users or key fields that have to be
filled can be validated against before you update the current record. That
way you will use the standard functionality of Access and you have much less
maintenance to do on your table..
--
Maurice Ausum


aMack said:
The table is sorted by the [REF#] and a new record is MAX[REF#]+1.

The reason I am using a sperate form to add a new record is that users have
had a tendancy to change key fields like [Customer Name] by mistake without
knowing it - I made the key fields like [Customer Name] locked on the main
form which means I can't just add a new record since the key fields can't be
blank and if they are locked the user can't change them on the new record.

???

--
A MACKENZIE, CMA, MBA


Maurice said:
Yep, there is a better way to do this but that depends on your db. I don't
know how this is setup. Looking at your macro the record is pasted into the
recordsource of the form.

The routine could be:

Open the form from a specific point or after an action taken with the
following parameter: DoCmd.OpenForm , acNormal, , , acFormAdd

This option will take you to a new record on the specific form.
The way I see it there's something else going on in your db. The macro
states it has to copy and paste a record into the recordsource. In that case
what is it what you expect? Do you expect to see the added record as the last
record or do you expect it to get focus on that record. If your form is based
on a table it might not be the last record but somewhere in between the other
records e.g the table isn't sorted.

so try to elaborate a little more on the situation of your db so we can
figure out how to solve this for you.
 
There is no Append feature.

Both forms work off the same query.


--
A MACKENZIE, CMA, MBA


Maurice said:
So you are using some sort of backup table which you append from by copying
and pasting the record right? I my opinion you could use a regular append
query for that. Although I must admit that you should reconsider the setup of
your original form. Data being changed by users or key fields that have to be
filled can be validated against before you update the current record. That
way you will use the standard functionality of Access and you have much less
maintenance to do on your table..
--
Maurice Ausum


aMack said:
The table is sorted by the [REF#] and a new record is MAX[REF#]+1.

The reason I am using a sperate form to add a new record is that users have
had a tendancy to change key fields like [Customer Name] by mistake without
knowing it - I made the key fields like [Customer Name] locked on the main
form which means I can't just add a new record since the key fields can't be
blank and if they are locked the user can't change them on the new record.

???

--
A MACKENZIE, CMA, MBA


Maurice said:
Yep, there is a better way to do this but that depends on your db. I don't
know how this is setup. Looking at your macro the record is pasted into the
recordsource of the form.

The routine could be:

Open the form from a specific point or after an action taken with the
following parameter: DoCmd.OpenForm , acNormal, , , acFormAdd

This option will take you to a new record on the specific form.
The way I see it there's something else going on in your db. The macro
states it has to copy and paste a record into the recordsource. In that case
what is it what you expect? Do you expect to see the added record as the last
record or do you expect it to get focus on that record. If your form is based
on a table it might not be the last record but somewhere in between the other
records e.g the table isn't sorted.

so try to elaborate a little more on the situation of your db so we can
figure out how to solve this for you.


--
Maurice Ausum


:

The Input form and the new record number is generated thorugh a Macro:

Openquery
RunCommand - Copy
Close - Query
OpenForm - "Transload New"
GoToRecord - New
GoToControl - REF#
RunCommand - Paste


I am sure there is an easier way to do this??


--
A MACKENZIE, CMA, MBA


:

That's strange because when you add a record in normal mode you would see it
immediately. How is your form setup? Are you using a savebutton or something
like that or is your form in data-entry mode perhaps.
--
Maurice Ausum


:

have created an input form for new records from our main production form.

The main form does not refresh after the new record is added.

I have to exit and reopen to see the new record.

Where can I put a Refresh command to show the new record immediately?


We tried Refresh and Requery on the "AfterUpdate" event of the Input form
but it did not work like I had thought.

Thanks
 
Back
Top