Kamis, 14 Juli 2011

[MS_AccessPros] Re: Me.dirty not saving changes after initial save

 

Good morning Bill,

Yes, it works perfectly on the first record then will not work after a second, third, or more record is displayed. It doesn't matter whether I select the new record with a combo box or use the navigation buttons. Once a record has been saved, it no longer saves any changes I make to other records. I have stripped out all other code except Me.dirty = false and me.refresh and it still happens. The reason I display the other form is because it closes after about 2 seconds and the user doesn't have to click OK. If there is a way to close a MSGBOX automatically, I don't know how. I've tried creating a new form but I did copy some of the items from the old form and it does the same thing. I've tried to create a sample for uploading and after stripping out the unnecessary stuff and importing the tables from the BE, the sample started working perfectly. It's about to drive me nuts! Perhaps I should try creating a new form and not copying anything?

Doyce

--- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@...> wrote:
>
> Doyce
>
> It works one time and then blows up? Try putting a breakpoint at the start of the event. When the code breaks press F8 to step through it so you can see what is happening.
>
> Also comment out all error handling if you have any in that procedure when debugging.
>
> One more thing...
> Why add the extra form when all you need is a MsgBox?
>
> Bill
>
> --- In MS_Access_Professionals@yahoogroups.com, "dnwinberry" <winberry.doyce@> wrote:
> >
> > Has anyone had any other ideas on this? I appreciate the help.
> >
> > Doyce
> >
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "dnwinberry" <winberry.doyce@> wrote:
> > >
> > > Hi Crystal,
> > >
> > > Thanks for responding. Here is the SQL for the query:
> > >
> > > SELECT tblReconPrimary.UnitID, tblReconPrimary.ArrivalDate, tblReconPrimary.PComments, tblReconPrimary.PROGRAM, tblReconPrimary.LicREquest, tblReconPrimary.[Loaded Comments], tblReconPrimary.ShipDocPrinted, tblReconPrimary.Proccessed, tblReconPrimary.DateProcessed, tblReconPrimary.RegReceived, tblTruckloadTagDate.TagDate, tblTruckloadTagDate.Comments, tblTruckloadDeliveryLocations.[DELIVERY ID], tblTruckloadDeliveryLocations.DELIVERYLOCATION, tblTruckloadDelivery.[Delivery Date], tblCTLVINs.[License State], tblCTLVINs.[License Plate Number], tblCTLVINs.Year, tblCTLVINs.Make, tblCTLVINs.[Serial Number], tblTruckloadDeliveryLocations.DELIVERYLOCATION, tblTruckloadDelivery.TruckID, tblTruckloadTagDate.SuspensionSerialNumber
> > > FROM tblTruckloadDeliveryLocations RIGHT JOIN (((tblReconPrimary LEFT JOIN tblTruckloadDelivery ON tblReconPrimary.UnitID = tblTruckloadDelivery.[Unit #]) LEFT JOIN tblCTLVINs ON tblReconPrimary.UnitID = tblCTLVINs.[Old Number]) LEFT JOIN tblTruckloadTagDate ON tblReconPrimary.UnitID = tblTruckloadTagDate.UnitID) ON tblTruckloadDeliveryLocations.[DELIVERY ID] = tblTruckloadDelivery.DeliveryID;
> > >
> > > Here are the tables and their PK's:
> > >
> > > tblReconPrimary - UnitID
> > > tblTruckloadTagDate - UnitID
> > > tblTruckloadDelivery - Unit#
> > > tblTruckloadDeliveryLocations - Delivery ID
> > > tblCTLVins - Old Number
> > >
> > > 'do you have fields in the table design :
> > > '- designated as Required? NO
> > > '- text fields with no for AllowZeroLength? NO
> > > '- DefaultValue specified when it should be blank (especially check numeric foreign keys) NO
> > >
> > > The query is updateable.
> > >
> > > 'Do you have a form BeforeUpdate event? NO
> > >
> > > I appreciate you taking the time to help!!
> > >
> > > Doyce
> > >
> > >
> > >
> > > --- In MS_Access_Professionals@yahoogroups.com, Crystal <strive4peace2008@> wrote:
> > > >
> > > > Hi Doyce,
> > > >
> > > > what is the SQL for the query?
> > > >
> > > > do you have fields in the table design :
> > > > - designated as Required?
> > > > - text fields with no for AllowZeroLength?
> > > > - DefaultValue specified when it should be blank (especially check numeric foreign keys)
> > > >
> > > > what unique indexes are on the table(s) in the query?
> > > >
> > > > ~~~
> > > > this attempts to save the record:
> > > > Me.Dirty = False
> > > >
> > > > Do you have a form BeforeUpdate event?
> > > >
> > > > although it is cheap, after I do me.dirty = false, I test it again. For now, this might be a good idea till you can figure out why the record isn't saving -- at least your message won't tell the user it is saved.
> > > >
> > > >
> > > > Warm Regards,
> > > > Crystal
> > > >
> > > > *
> > > > (: have an awesome day :)
> > > > *
> > > >
> > > >
> > > > --- On Wed, 7/13/11, dnwinberry wrote:
> > > >
> > > >
> > > > > Hello all,
> > > > >
> > > > > I have a bound form that displays information from several
> > > > > different tables. It's record source is a query. When I
> > > > > change some of the data, I have a Save button that becomes
> > > > > visible with an on click event to save the changes. It's
> > > > > code is:
> > > > > If Me.Dirty Then
> > > > >         Me.Dirty = False
> > > > >         'display splash form "Record
> > > > > has been saved" which closes automatically
> > > > >         DoCmd.OpenForm
> > > > > "frmRecordIsSaved", acNormal
> > > > >         Me.cboLookup.SetFocus
> > > > >         Me.btnSave.Visible = False
> > > > >         Me.Refresh
> > > > >     End If
> > > > >
> > > > > This works fine for the first record that is changed.
> > > > > However, after I have saved one record and display another
> > > > > and change something the procedure doesn't save the changes.
> > > > > It gives no errors, the form is refreshed and the changes
> > > > > are gone. Thinking I might have form corruption, I built a
> > > > > new form and it is doing the same thing. I went to prepare a
> > > > > sample for uploading and after deleting all the extra forms,
> > > > > reports and etc. and importing the tables from the backend
> > > > > into the front end, the behavior stopped and it started
> > > > > working perfectly. I'm bum-fuzzled. Does anyone have a clue
> > > > > as to why this might be happening?
> > > > >
> > > > > Doyce
> > > > >
> > > > >
> > > >
> > >
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar