Hi,
I have a Access 2003 database Form that opens containing data from one table and when clicking a button i wish it to transfer the forms text box information into another form, for the reason being that i wish to delete the original information ("session" table) where all the current data is and make a copy of it into another table ("Session_CL X" table) for it to be archived.
What changes do i need to make in code?
i hope you can help... Colin
a sample of my inheritted code is as below:-
'-------------------------------------------------------
'-------------------------------------------------------
Private Sub btnDelete_Click ()
Dim dbs As Database, qdf As QueryDef, rst As Recordset
' Return reference to current database.
Set dbs = CurrentDb
' Create new query.
Set qdf = dbs.CreateQuery Def("")
' Construct SQL statement including parameters.
qdf.SQL = "PARAMETERS [simcode] TEXT, " & _
"[start_date] DATETIME, [end_date] DATETIME," & _
"[session_type] STRING, [customer_code] STRING, " & _
"[checkee] STRING, [checker] STRING, [prog_code] STRING, " & _
"[simconfig] STRING, [simfmc] STRING,[updated_date] STRING,[Instructor] STRING; " & _
"INSERT into session_last ( simulator_code, session_start, session_type," & _
"customer_c ode, session_end, " & _
"checker_na me, checkee_name, " & _
"program_co de, sim_fmc, sim_config, updated_date, priv_fee, sim_motion_type , Instructor, Case, CLX_Date, CLX_UserName, CLX_Authority, CLX_Reason ) values ( [simcode], [start_date]," & _
"[session_type], [customer_code], [end_date], " & _
"[checker], " & _
"[checkee], [prog_code], " & _
"[simfmc], [simconfig], [updated_date], [priv_fee], [sim_motion_type],[Instructor], [Case], [CLX_Date], [CLX_UserName], [CLX_Authority], [CLX_Reason]);"
qdf.Parameters( "simcode") = simulatorCode
qdf.Parameters( "start_date ") = txtStartDate & " " & txtStartTime
qdf.Parameters( "end_date") = txtEndDate & " " & txtEndTime
qdf.Parameters( "session_ty pe") = cboSessionType
qdf.Parameters( "customer_code" ) = cboCustomerCode
qdf.Parameters( "checkee") = txtUsercreate
qdf.Parameters( "checker") = txtSpecialDetai ls
qdf.Parameters( "prog_code" ) = cboProgramCode
qdf.Parameters( "simconfig" ) = cboSimConfig
qdf.Parameters( "simfmc") = cboFmc_Load
qdf.Parameters( "Instructor ") = cboInstructor
qdf.Parameters( "updated_da te") = txtcreatedate
qdf.Parameters( "priv_fee") = txtPrivFee
qdf.Parameters( "sim_motion_typ e") = cboSimMotionTyp e
qdf.Parameters( "Case") = cboCase
qdf.Parameters( "CLX_UserNa me") = txtEmployee
qdf.Parameters( "CLX_Date") = txtCLXDate
qdf.Parameters( "CLX_Authority" ) = txtCLXAuthority
qdf.Parameters( "CLX_Reason ") = txtCLXReason
'Run select query and populate
Debug.Print "about to execute the update"
qdf.Execute
Set dbs = Nothing
End Sub
'--------------------------------------------------------------------------
'--------------------------------------------------------------------------
I have a Access 2003 database Form that opens containing data from one table and when clicking a button i wish it to transfer the forms text box information into another form, for the reason being that i wish to delete the original information ("session" table) where all the current data is and make a copy of it into another table ("Session_CL X" table) for it to be archived.
What changes do i need to make in code?
i hope you can help... Colin
a sample of my inheritted code is as below:-
'-------------------------------------------------------
'-------------------------------------------------------
Private Sub btnDelete_Click ()
Dim dbs As Database, qdf As QueryDef, rst As Recordset
' Return reference to current database.
Set dbs = CurrentDb
' Create new query.
Set qdf = dbs.CreateQuery Def("")
' Construct SQL statement including parameters.
qdf.SQL = "PARAMETERS [simcode] TEXT, " & _
"[start_date] DATETIME, [end_date] DATETIME," & _
"[session_type] STRING, [customer_code] STRING, " & _
"[checkee] STRING, [checker] STRING, [prog_code] STRING, " & _
"[simconfig] STRING, [simfmc] STRING,[updated_date] STRING,[Instructor] STRING; " & _
"INSERT into session_last ( simulator_code, session_start, session_type," & _
"customer_c ode, session_end, " & _
"checker_na me, checkee_name, " & _
"program_co de, sim_fmc, sim_config, updated_date, priv_fee, sim_motion_type , Instructor, Case, CLX_Date, CLX_UserName, CLX_Authority, CLX_Reason ) values ( [simcode], [start_date]," & _
"[session_type], [customer_code], [end_date], " & _
"[checker], " & _
"[checkee], [prog_code], " & _
"[simfmc], [simconfig], [updated_date], [priv_fee], [sim_motion_type],[Instructor], [Case], [CLX_Date], [CLX_UserName], [CLX_Authority], [CLX_Reason]);"
qdf.Parameters( "simcode") = simulatorCode
qdf.Parameters( "start_date ") = txtStartDate & " " & txtStartTime
qdf.Parameters( "end_date") = txtEndDate & " " & txtEndTime
qdf.Parameters( "session_ty pe") = cboSessionType
qdf.Parameters( "customer_code" ) = cboCustomerCode
qdf.Parameters( "checkee") = txtUsercreate
qdf.Parameters( "checker") = txtSpecialDetai ls
qdf.Parameters( "prog_code" ) = cboProgramCode
qdf.Parameters( "simconfig" ) = cboSimConfig
qdf.Parameters( "simfmc") = cboFmc_Load
qdf.Parameters( "Instructor ") = cboInstructor
qdf.Parameters( "updated_da te") = txtcreatedate
qdf.Parameters( "priv_fee") = txtPrivFee
qdf.Parameters( "sim_motion_typ e") = cboSimMotionTyp e
qdf.Parameters( "Case") = cboCase
qdf.Parameters( "CLX_UserNa me") = txtEmployee
qdf.Parameters( "CLX_Date") = txtCLXDate
qdf.Parameters( "CLX_Authority" ) = txtCLXAuthority
qdf.Parameters( "CLX_Reason ") = txtCLXReason
'Run select query and populate
Debug.Print "about to execute the update"
qdf.Execute
Set dbs = Nothing
End Sub
'--------------------------------------------------------------------------
'--------------------------------------------------------------------------
Comment