A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

On Save of new record, screen jumps to another record.



 
 
Thread Tools Display Modes
  #1  
Old March 31st, 2005, 04:39 PM
Don
external usenet poster
 
Posts: n/a
Default On Save of new record, screen jumps to another record.

Hello, I have an access 97 application that uses a bound form. In the past I
would
use
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord on the click event of a
button that would save and close the screen. This worked fine.

I changed to have the ability to just save while on the screen and not close
it. For a new record, it will correctly save the record but the screen jumps
to a different row in the query. Why would this be happening? Initially the
form was linked to a multiple table query but I switched it to directly go
against one table and I get the same results.

Thanks

Don

  #2  
Old March 31st, 2005, 05:17 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Don" wrote in message

Hello, I have an access 97 application that uses a bound form. In
the past I would
use
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord on the click event
of a button that would save and close the screen. This worked fine.

I changed to have the ability to just save while on the screen and
not close it. For a new record, it will correctly save the record
but the screen jumps to a different row in the query. Why would this
be happening? Initially the form was linked to a multiple table
query but I switched it to directly go against one table and I get
the same results.


Although I haven't checked it out in detail, I strongly suspect that
you're using the wrong menu items. These are easy to get confused,
since you're dealing with defined constants that have different effects
depending on where they're used. I suggest you use the appropriate
RunCommand or DoCmd methods instead of DoMenuItem, since these are
unambiguous.

To save the current record:

RunCommand acCmdSaveRecord

To save the record and close the form:

RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name

Although, since the record will be saved if possible (and if necessary)
when the form is closed, you could just write:

DoCmd.Close acForm, Me.Name

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old March 31st, 2005, 06:51 PM
Don
external usenet poster
 
Posts: n/a
Default

That still gives me the same issue.

"Dirk Goldgar" wrote:

"Don" wrote in message

Hello, I have an access 97 application that uses a bound form. In
the past I would
use
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord on the click event
of a button that would save and close the screen. This worked fine.

I changed to have the ability to just save while on the screen and
not close it. For a new record, it will correctly save the record
but the screen jumps to a different row in the query. Why would this
be happening? Initially the form was linked to a multiple table
query but I switched it to directly go against one table and I get
the same results.


Although I haven't checked it out in detail, I strongly suspect that
you're using the wrong menu items. These are easy to get confused,
since you're dealing with defined constants that have different effects
depending on where they're used. I suggest you use the appropriate
RunCommand or DoCmd methods instead of DoMenuItem, since these are
unambiguous.

To save the current record:

RunCommand acCmdSaveRecord

To save the record and close the form:

RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name

Although, since the record will be saved if possible (and if necessary)
when the form is closed, you could just write:

DoCmd.Close acForm, Me.Name

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



  #4  
Old March 31st, 2005, 07:06 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

Hmm. I suspect the operation of code or a macro in the form's
AfterUpdate event. Please post the complete code from the form's code
module.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

"Don" wrote in message
news
That still gives me the same issue.

"Dirk Goldgar" wrote:

"Don" wrote in message

Hello, I have an access 97 application that uses a bound form. In
the past I would
use
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord on the click event
of a button that would save and close the screen. This worked fine.

I changed to have the ability to just save while on the screen and
not close it. For a new record, it will correctly save the record
but the screen jumps to a different row in the query. Why would
this be happening? Initially the form was linked to a multiple
table query but I switched it to directly go against one table and
I get the same results.


Although I haven't checked it out in detail, I strongly suspect that
you're using the wrong menu items. These are easy to get confused,
since you're dealing with defined constants that have different
effects depending on where they're used. I suggest you use the
appropriate RunCommand or DoCmd methods instead of DoMenuItem, since
these are unambiguous.

To save the current record:

RunCommand acCmdSaveRecord

To save the record and close the form:

RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name

Although, since the record will be saved if possible (and if
necessary) when the form is closed, you could just write:

DoCmd.Close acForm, Me.Name




  #5  
Old March 31st, 2005, 08:51 PM
Don
external usenet poster
 
Posts: n/a
Default

Dirk, Thanks for the suggestion, I finally traced the problem to a trigger
running on the table.

"Dirk Goldgar" wrote:

Hmm. I suspect the operation of code or a macro in the form's
AfterUpdate event. Please post the complete code from the form's code
module.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

"Don" wrote in message
news
That still gives me the same issue.

"Dirk Goldgar" wrote:

"Don" wrote in message

Hello, I have an access 97 application that uses a bound form. In
the past I would
use
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord on the click event
of a button that would save and close the screen. This worked fine.

I changed to have the ability to just save while on the screen and
not close it. For a new record, it will correctly save the record
but the screen jumps to a different row in the query. Why would
this be happening? Initially the form was linked to a multiple
table query but I switched it to directly go against one table and
I get the same results.

Although I haven't checked it out in detail, I strongly suspect that
you're using the wrong menu items. These are easy to get confused,
since you're dealing with defined constants that have different
effects depending on where they're used. I suggest you use the
appropriate RunCommand or DoCmd methods instead of DoMenuItem, since
these are unambiguous.

To save the current record:

RunCommand acCmdSaveRecord

To save the record and close the form:

RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name

Although, since the record will be saved if possible (and if
necessary) when the form is closed, you could just write:

DoCmd.Close acForm, Me.Name





 




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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save pp ffor presentation full screen view curly Powerpoint 1 March 29th, 2005 08:04 PM
Outlook: Will not save passwords. XP intro screen shows wrong # scottsdale dude Installation & Setup 0 February 9th, 2005 02:29 PM
Save Record Charles Using Forms 2 December 2nd, 2004 08:14 AM
Save the current record Warrio Using Forms 3 October 6th, 2004 09:39 PM


All times are GMT +1. The time now is 07:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.