Hi! I need to create a macro in Access 2000. I've never used access before, so sorry if this comes off as a stupid question. I've scrounged together some vb code that will allow me to delete a table's contents, then import new contents from an Excel spreadsheet but so far the only way I can run it is by running it directly from the Visual Basic Editor(ie. Tools > Macro > Visual Basic Editor). How can I make a macro out of this or make it available in a user-friendly way? (basically, I want to make it easier to access for people--like clicking a button, having it as a menu option,etc.) Thanks!
Here's the code: -----------------------------------------------
Function GET_RESIDENT_DATA()
On Error GoTo GET_RESIDENT_DATA_Err
CurrentDb.Execute "Delete * from [Resident Nutritional Profile]"
DoCmd.OpenTable "Resident Nutritional Profile", acViewNormal, acAdd
DoCmd.GoToRecord acTable, "Resident Nutritional Profile", acFirst
DoCmd.TransferSpreadsheet acImport, 8, "Resident Nutritional Profile", "C:\Resident Nutritional Profile.xls", True, ""
GET_RESIDENT_DATA_Exit:
Exit Function
GET_RESIDENT_DATA_Err:
MsgBox Error$
Resume GET_RESIDENT_DATA_Exit
End Function
Here's the code: -----------------------------------------------
Function GET_RESIDENT_DATA()
On Error GoTo GET_RESIDENT_DATA_Err
CurrentDb.Execute "Delete * from [Resident Nutritional Profile]"
DoCmd.OpenTable "Resident Nutritional Profile", acViewNormal, acAdd
DoCmd.GoToRecord acTable, "Resident Nutritional Profile", acFirst
DoCmd.TransferSpreadsheet acImport, 8, "Resident Nutritional Profile", "C:\Resident Nutritional Profile.xls", True, ""
GET_RESIDENT_DATA_Exit:
Exit Function
GET_RESIDENT_DATA_Err:
MsgBox Error$
Resume GET_RESIDENT_DATA_Exit
End Function