Options

SQL Statement

Megadeth4168Megadeth4168 Member Posts: 2,157
DoCmd.RunSQL ("INSERT INTO [history] SELECT * FROM [lot] WHERE [Lot_Number]= " & Me.Lot_Number)

I'm weak with SQL so I need a bit of help. All I want to do is copy a record from table lot to table history. I am doing this from a command button on a form.

The command I have above copies all records from table lot to table history instead of just the current record I am on.

Comments

  • Options
    Silver BulletSilver Bullet Member Posts: 676 ■■■□□□□□□□
    Is this about that history table you was wanting to make and I suggested making an Update Query?

    Are you still using Access?
    If so then just use the Query builder and show both tables in the query builder. Insert the fields you want to update and in the update to field insert the field that you want it to be.

    Let me know if that is way off base..... but if I remember right from one of your previous post then that should work.
  • Options
    Megadeth4168Megadeth4168 Member Posts: 2,157
    You are correct, it is about the histroy table... I had actually not gotten to work on that part of the database until today. So I kind of lost track of my question on here...

    Anyway, I ended up using an Append query... Append from Lot to History... Then under Criteria I pointed to the form/field I was using. I then made a button in the form that executes the Append query and then deletes the current record from the lot table.

    I think your method would work as well... I guess I found out that there are several ways to do what I wanted to do.

    Thanks for the help :)
Sign In or Register to comment.