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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
"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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |