kitaeshi
06-10-2007, 04:39 PM
hi all, i create a form which have a button to append the current entry to another table but i only want to append the current entry tat is open. So how do u set the query to append one entry(the current open entry on the form) using the criteria.
i notice the query only have sum, aver, +- ...etc..
tks.
WayneRyan
06-10-2007, 07:32 PM
K,
What are you wanting to send over to the other table?
The whole record?
Just the Primary Key?
Wayne
WayneRyan
06-10-2007, 07:43 PM
K,
I haven't a clue as to why, or how much, of the current record that
you want to move, but here's a method:
DoCmd.RunSql "Insert Into YourTable (Field1, Field2, Field3) " & _
"Values ('" & Me.Field1 & "', " & _ <-- String Field
Me.Field2 & ", #" & _ <-- Numeric Field
Me.Field3 & "#)"
which equates to:
Insert Into YourTable (Field1, Field2, Field3)
Values ('Field1', Field2, #Field3#)
If you're copying an entire row to an audit table (that has the same structure):
Insert Into tblAudit
Select * From YourCurrentTable Where ThePrimaryKey = YourFormsPrimaryKey
Wayne
kitaeshi
06-10-2007, 10:52 PM
actually i have 2 table. my main purpose is to duplicated field1 from table1 to table2 n deleted field1 after i duplicated. i do it on a form so i need to know how to set query for criteria to select the current record on the form. but i dun know wats the criteria. i not going to use sql as there are like 30+ fields so its going to be a lot of mistakes here and there.
and by the way can sql duplicated the whole record to another table? without listing out each field into each values
Moniker
06-10-2007, 10:53 PM
Umm..
YourRecordset.AbsolutePosition
- or -
YourRecordset.CurrentRecord
kitaeshi
06-10-2007, 11:10 PM
doesn't work it prompt me a box to fill in a number. but still cannot get the current record number or id number
Moniker
06-10-2007, 11:40 PM
You're going to have to elaborate on your structure a little bit as it's not making sense at all. Are you using ADO here? Are you using all queries? AbsolutePosition and CurrentRecord are both properties, not parameters, so I'm not sure what you're being prompted for.
kitaeshi
06-11-2007, 01:28 AM
actually wat i want to do is very simple. i have two table, i need to duplicate one record from one table to another table. tats all. due to the fact tat it have 30-40 field i try to avoide using mysql to avoid mistakes. so is there any easy wat?