Hello all.
I am fairly inepxerienced with access so this question may seem dumb.
basically, i am trying to copy a certain record from one table to another.
So. I have a Form which allows users to select values from list boxes. These values are then added to the movements table using the INSERT INTO SQL command. Easy to do.
However, once the code for this has been run i then want the program to copy the phone numbers for these people from Tabe 2 based on what first name and second name I have entered into Table 1.
The above is an example of what I am trying to do as It would take me ages to explain it all..
However, I also want the code to add a few more fields which are automatically picked up from another table (say oreBlocks) which adds additional data into the movements table based on some of the data the user has selected.
I hope that makes sense?
Can anyone help with this?
Below is the code I have used for the Command Button:-
----CODE ----
Private Sub ID_Add_Data_Click()
Dim Recdate As Date
Dim Rectime As Date
Dim RecShift As String
Dim RecFlitch As Single
Dim RecBlock As String
Dim RecDest As String
Dim Rectruck As String
Dim RecExcav As String
Dim RecSpotter As String
Dim Recaugc As Double
'Gather the data into variables
Recdate = ID_Date.Value
Rectime = ID_time.Value
RecShift = ID_shift.Value
RecFlitch = ID_Flitchs.Value
RecBlock = ID_oreblock.Value
RecDest = ID_destination.Value
Rectruck = ID_Truck.Value
RecExcav = ID_Excavators.Value
RecSpotter = ID_Spotter.Value
'Place the Variables into the Movements Table using the SQL INSERT INTO command
Dim strSQLADDY As String
strSQLADDY = "INSERT INTO [Movements]( [Date_m], [Time], [Shift], [Flitch], [OreBlock], [Destination], [TruckNum], [Spotter], [Excavator] )" & _
"VALUES ('" & ID_Date & "','" & Rectime & "','" & ID_shift & "'," & RecFlitch & ",'" & RecBlock & "','" & RecDest & "','" & Rectruck & "','" & RecSpotter & "','" & RecExcav & "')"
DoCmd.RunSQL strSQLADDY
End Sub