Re: Deleting Data

Tech-Archive recommends: Speed Up your PC by fixing your registry



Thank you Alex for the help. I entered the delete query into the visual
basic code editor under the AfterUpdate tab:

CurrentDb.Execute "Delete * From [Live Traffic Log] Where Trailer = " &
Me!Trailer

I have trailer 500 in the Live Traffic Log and when I enter the trailer into
the Outbound form I get the error message:

Run-time error '3464'
Date type mismatch in criteria expression

Do you have any ideas? I have Trailer defined in the table as a text field
so it's not a number. Does that matter? Sometimes the Trailer may contain
numbers and letters so I went with a text field just to be safe.

Thanks again for any help.

Trent C.






"Alex Dybenko" wrote:

> hi,
> Access does not support triggers, so you can only automate this using form.
> so in Outbound form you can use AfterUpdate event to run delete query:
> currentdb.execute "Delete * from [Live Log.] Where ID=" & me.ID
>
> Where ID - identifier what record to delete
>
> HTH
> --
> Alex Dybenko (MVP)
> http://alexdyb.blogspot.com
> http://www.PointLtd.com
>
>
>
> "Trent C." <Trent C.@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:89A705F4-5EC7-4D3F-A72B-D3776F91AD22@xxxxxxxxxxxxxxxx
> > Hello,
> >
> > Before I ask my question let me take a second and explain a little about
> > what i'm doing so it makes a little more sense. I work at a Distribution
> > Center (DC) and I am currently working on an Access database that will
> > track
> > every single trailer that comes in and goes out of the DC. A guard at the
> > main entrance will enter the data into the database and then the different
> > departments within the DC will use reports to know what they have on hand.
> >
> > I have two tables. (Traffic Log and Live Traffic Log). Basically they are
> > the same, with the exception that the Traffic Log table will be like a
> > archive (showing trailers going in and out) and the Live Traffic Log
> > holding
> > only the trailers that we have on site. Once a trailer leaves the DC it's
> > deleted from the Live Log.
> >
> > The Question:
> >
> > I currently have 2 forms. An Inbound entry form (Handles trailers coming
> > in) and an Outbound Form (Handles trailers leaving the DC). Is there a
> > way
> > to have the database automatically delete the record I enter into the
> > Outbound form from the Live Log? When the guard enters a trailer into the
> > Outbound form it adds a record to the Traffic Log, but in the meantime I
> > need
> > it to delete the Inbound record in the Live Log. Is this possible?
> >
> > Any help would be greatly appreciated.
> >
> > Thanks,
> >
> > --Trent C.
> >
>
>
>
.