how to set query on the current record

kitaeshi

Registered User.
Local time
Today, 16:01
Joined
Jun 9, 2007
Messages
30
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.
 
K,

What are you wanting to send over to the other table?

The whole record?

Just the Primary Key?

Wayne
 
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:

Code:
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
 
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
 
Umm..

YourRecordset.AbsolutePosition

- or -

YourRecordset.CurrentRecord
 
doesn't work it prompt me a box to fill in a number. but still cannot get the current record number or id number
 
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.
 
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?
 

Users who are viewing this thread

Back
Top Bottom