Updating Form/query/table

bessej43

Registered User.
Local time
Today, 16:54
Joined
Jun 12, 2002
Messages
22
Need a little help:

Table:

1. I have a table where I store name's and ssan's
2. Another table with other data; ie dates, amounts, etc. with the above table info.

Query:

1. Made one query using both tables.

Sql:

SELECT [Copy of Leave Control Log a].[Leave Number], [Copy of Leave Control Log a].[Issue Date], [Master Alpha].[Full Name], [Master Alpha].[Unit Desc], [Master Alpha].[Grade Desc], [Master Alpha].[Current Duty Phone], [Master Alpha].SSAN, [Copy of Leave Control Log a].[Leave From], [Copy of Leave Control Log a].[Leave To], [Copy of Leave Control Log a].Remarks, [Copy of Leave Control Log a].[ISSUE DATE +6], [Copy of Leave Control Log a].[SB01/SB03 DATE], [Copy of Leave Control Log a].[RETURN DATE +3], [Copy of Leave Control Log a].[DATE PART III RECD], [Copy of Leave Control Log a].[CANCEL/CORRECT], [Copy of Leave Control Log a].[SB05/06], [Copy of Leave Control Log a].[CORRECTED LEAVE DATE FROM], [Copy of Leave Control Log a].[CORRECTED LEAVE DATE TO], [Copy of Leave Control Log a].[TYPE LEAVE]
FROM [Copy of Leave Control Log a] INNER JOIN [Master Alpha] ON [Copy of Leave Control Log a].SSAN = [Master Alpha].SSAN;

Form:

1. Made a form from the query. I am updating the other information but not the name or ssan.

2. I have a button to find a name, then input the other data


This is what I want to do:

1. I want to add the data from the form directly into a different table (Leave Control Log) with changing my other tables.

Any assistance would be greatly appreciated. Thank you.
 
Add the following code:

Code:
Dim DB As Database
Dim RST As Recordset
Set DB = CurrentDb
Set RST = DB.OpenRecordset("Leave Control Log")
RST.AddNew
RST!Field1 = Forms!FormName!Field1
RST!Field2 = Forms!FormName!Field2
RST!Field3 = Forms!FormName!Field3
RST.Update
Set RST = Nothing
Set DB = Nothing
 

Users who are viewing this thread

Back
Top Bottom