S
samueltjones
Guest
Here is the code and it's purpose is to transfer a spreadsheet range into the database. It works fine apart from I need the name to always be the same. The Date - 4 works fine on it's own, but I also need it to add some text on to the end which in this case is Yr 3. Here is the code please have a go and write back. Thanks!!
P.s. I have coloured red the problem area.
'------------------------------------------------------------
' transferspreadsheetyr3
'
'------------------------------------------------------------
Function transferspreadsheet_test()
On Error GoTo transferspreadsheet_test_Err
DoCmd.transferspreadsheet acImport, 8, Date - 4 + "Yr 3", "C:\Documents and Settings\All Users\Documents\My Work\I.T\Chosen Project\Register Yr 3.xls", True, "import"
MsgBox "Transfer of the Yr 3's week attendance successful!!"
transferspreadsheet_test_Exit:
Exit Function
transferspreadsheet_test_Err:
MsgBox Error$
Resume transferspreadsheet_test_Exit
End Function

P.s. I have coloured red the problem area.
'------------------------------------------------------------
' transferspreadsheetyr3
'
'------------------------------------------------------------
Function transferspreadsheet_test()
On Error GoTo transferspreadsheet_test_Err
DoCmd.transferspreadsheet acImport, 8, Date - 4 + "Yr 3", "C:\Documents and Settings\All Users\Documents\My Work\I.T\Chosen Project\Register Yr 3.xls", True, "import"
MsgBox "Transfer of the Yr 3's week attendance successful!!"
transferspreadsheet_test_Exit:
Exit Function
transferspreadsheet_test_Err:
MsgBox Error$
Resume transferspreadsheet_test_Exit
End Function