I'm using Access 2000 & am trying to automate a process for another person. I'm getting a type mismatch where I indicate below. The next line of similar code runs fun, but for some reason it doesn't like that one line of code. I've tried Dim a string variable & putting it all in there & then running the string, but I get the type mismatch when I assign the string variable. Here is the code:
Dim i As Integer
Dim NumOfFiles As Integer
Dim Path As String
Path = GetDBPath()
NumOfFiles = InputBox("Please enter the number of Bid files to import.", _
"Number of Bid Files"
For i = 1 To NumOfFiles
txtStatus.Value = "Lot" & i & ": Importing"
DoCmd.TransferText acImportFixed, "USE THIS Import Specification", "Lot" & i, Path & "BIDS0" & i & ".txt", False
txtStatus.Value = "Lot" & i & ": Changing DBM field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN DBM TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LPayDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LPayDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LPurDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LPurDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LCADate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LCADate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LStatUpd field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LStatUpd TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing DateNAChg field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN DateNAChg TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing RefDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN RefDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing WODate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN WODate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Converting all Date/Time Fields"
***********Error Occurs Here************************
CurrentDb.Execute "UPDATE Lot" & i & " " & _
"SET Lot" & i & ".DBM = DateValue(Mid([DBM],4,2) & " / " & Mid([DBM],6,2) & " / " & Mid([DBM],2,2)), " & _
"Lot" & i & ".LPayDate = DateValue(Mid([LPayDate],4,2) & " / " & Mid([LPayDate],6,2) & " / " & Mid([LPayDate],2,2)), " & _
"Lot" & i & ".LPurDate = DateValue(Mid([LPurDate],4,2) & " / " & Mid([LPurDate],6,2) & " / " & Mid([LPurDate],2,2)), " & _
"Lot" & i & ".LCADate = DateValue(Mid([LCADate],4,2) & " / " & Mid([LCADate],6,2) & " / " & Mid([LCADate],2,2)), " & _
"Lot" & i & ".LStatUpd = DateValue(Mid([LStatUpd],4,2) & " / " & Mid([LStatUpd],6,2) & " / " & Mid([LStatUpd],2,2)), " & _
"Lot" & i & ".DateNAChg = DateValue(Mid([DateNAChg],4,2) & " / " & Mid([DateNAChg],6,2) & " / " & Mid([DateNAChg],2,2)), " & _
"Lot" & i & ".RefDate = DateValue(Mid([RefDate],4,2) & " / " & Mid([RefDate],6,2) & " / " & Mid([RefDate],2,2)), " & _
"Lot" & i & ".WODate = DateValue(Mid([WODate],4,2) & " / " & Mid([WODate],6,2) & " / " & Mid([WODate],2,2));"
************************************************************
txtStatus.Value = "Lot" & i & ": Converting all Numeric Fields"
!!!!!!!!!!!!!!This works fine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CurrentDb.Execute "UPDATE Lot" & i & " " & _
"SET Lot" & i & ".APR = [APR]/1000, Lot" & i & ".LPayAmt = [LPayAmt]/100, " & _
"Lot" & i & ".OrigBal = [OrigBal]/100, Lot" & i & ".CurrBal = [CurrBal]/100, " & _
"Lot" & i & ".RefAmt = [RefAmt]/100, Lot" & i & ".WOAmt = [WOAmt]/100, Lot" & i & ".WOInt = [WOInt]/100;"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
txtStatus.Value = "Lot" & i & ": Done"
Next
Any insight would be appreciated.
Dim i As Integer
Dim NumOfFiles As Integer
Dim Path As String
Path = GetDBPath()
NumOfFiles = InputBox("Please enter the number of Bid files to import.", _
"Number of Bid Files"
For i = 1 To NumOfFiles
txtStatus.Value = "Lot" & i & ": Importing"
DoCmd.TransferText acImportFixed, "USE THIS Import Specification", "Lot" & i, Path & "BIDS0" & i & ".txt", False
txtStatus.Value = "Lot" & i & ": Changing DBM field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN DBM TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LPayDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LPayDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LPurDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LPurDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LCADate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LCADate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing LStatUpd field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN LStatUpd TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing DateNAChg field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN DateNAChg TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing RefDate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN RefDate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Changing WODate field size to 10"
CurrentDb.Execute "ALTER TABLE Lot" & i & " ALTER COLUMN WODate TEXT(10);"
txtStatus.Value = "Lot" & i & ": Converting all Date/Time Fields"
***********Error Occurs Here************************
CurrentDb.Execute "UPDATE Lot" & i & " " & _
"SET Lot" & i & ".DBM = DateValue(Mid([DBM],4,2) & " / " & Mid([DBM],6,2) & " / " & Mid([DBM],2,2)), " & _
"Lot" & i & ".LPayDate = DateValue(Mid([LPayDate],4,2) & " / " & Mid([LPayDate],6,2) & " / " & Mid([LPayDate],2,2)), " & _
"Lot" & i & ".LPurDate = DateValue(Mid([LPurDate],4,2) & " / " & Mid([LPurDate],6,2) & " / " & Mid([LPurDate],2,2)), " & _
"Lot" & i & ".LCADate = DateValue(Mid([LCADate],4,2) & " / " & Mid([LCADate],6,2) & " / " & Mid([LCADate],2,2)), " & _
"Lot" & i & ".LStatUpd = DateValue(Mid([LStatUpd],4,2) & " / " & Mid([LStatUpd],6,2) & " / " & Mid([LStatUpd],2,2)), " & _
"Lot" & i & ".DateNAChg = DateValue(Mid([DateNAChg],4,2) & " / " & Mid([DateNAChg],6,2) & " / " & Mid([DateNAChg],2,2)), " & _
"Lot" & i & ".RefDate = DateValue(Mid([RefDate],4,2) & " / " & Mid([RefDate],6,2) & " / " & Mid([RefDate],2,2)), " & _
"Lot" & i & ".WODate = DateValue(Mid([WODate],4,2) & " / " & Mid([WODate],6,2) & " / " & Mid([WODate],2,2));"
************************************************************
txtStatus.Value = "Lot" & i & ": Converting all Numeric Fields"
!!!!!!!!!!!!!!This works fine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CurrentDb.Execute "UPDATE Lot" & i & " " & _
"SET Lot" & i & ".APR = [APR]/1000, Lot" & i & ".LPayAmt = [LPayAmt]/100, " & _
"Lot" & i & ".OrigBal = [OrigBal]/100, Lot" & i & ".CurrBal = [CurrBal]/100, " & _
"Lot" & i & ".RefAmt = [RefAmt]/100, Lot" & i & ".WOAmt = [WOAmt]/100, Lot" & i & ".WOInt = [WOInt]/100;"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
txtStatus.Value = "Lot" & i & ": Done"
Next
Any insight would be appreciated.