milkman2500
Registered User.
- Local time
- Yesterday, 21:00
- Joined
- Oct 21, 2012
- Messages
- 45
Hi,
I'm trying to run a saved import through VBA, add a new column called "Effective_Date", then update this field for all records to the effective date indicated by the user.
It currently works for all records except 1 is always ommitted. Any help is appreciated.
I'm trying to run a saved import through VBA, add a new column called "Effective_Date", then update this field for all records to the effective date indicated by the user.
It currently works for all records except 1 is always ommitted. Any help is appreciated.
Code:
Private Sub cmd_upload_staffing_report_Click()
DoCmd.RunSavedImportExport ("Import-AccessUploadStaffingReport")
Dim strField As String
Dim curDatabase As Object
Dim tblTempEmployees As Object
Dim fldEffectiveDate As Object
Dim inputResponse As Date
Dim rstEmployees As Recordset
'Creates new column "Effective_Date" in table t_temp_employees
Set curDatabase = CurrentDb
Set tblTempEmployees = curDatabase.TableDefs("t_temp_employees")
strField = "Effective_Date"
Set fldEffectiveDate = tblTempEmployees.CreateField(strField, dbDate)
tblTempEmployees.Fields.Append fldEffectiveDate
'Updates all records in the new "Effective_Date" field to the effective date
'indicated by the user through the input box
Set rstEmployees = curDatabase.OpenRecordset("t_temp_employees")
inputResponse = InputBox("What is the effective date of the report?")
With rstEmployees
Do While Not .EOF
.Edit
!Effective_Date = inputResponse
.Update
.MoveNext
Loop
.Close
End With
End Sub