Access VBA delete Table records with SQL using DoCMD.RunSQL Method

This Access VBA tutorial explains how to use VBA delete Table records with SQL without alert using DoCMD.RunSQL Method. You may also want to read: Access VBA run Query or run Action Query Access delete Table records In my previous post, I have explained how to delete Table records without using VBA, below is a quick recap. Suppose we have created a table called student in Access, which contains 5 student records. student Student ID Student Name 001 Apple 002 Bet...
Read More

Access Excel VBA sort Array items

This Access Excel VBA tutorial explains how to sort Array items in VBA in ascending order / descending order. You may also want to read: Use VBA Excel Function to sort data in ascending order Access Excel VBA sort Array items In an Array, you may have stored items that you want to sort. For example, if you store a name list, you may want to sort them in alphabetical order (Apple, Banana, Cat...).  If you store a number list, you may want to sort them in ascending order (100, 200, 400, 70...
Read More

Access VBA import workbook to Access using Transferspreadsheet

This Access tutorial explains how to import workbook to Access using DoCmd.Transferspreadsheet Method, such as importing specific worksheet to Access, importing multiple worksheets to Access. You may also want to read: Access VBA DoCmd.OutputTo Method Access Export all Queries to Excel Access VBA import workbook to Access using DoCmd.Transferspreadsheet Access VBA DoCmd.Transferspreadsheet Method is used to import workbook to Access and export Access to workbook, I have briefly demo...
Read More

Access VBA delete Table using DoCmd.DeleteObject Method

This Access VBA tutorial explains how to delete Table (delete single table, delete multiple tables) in VBA using DoCmd.DeleteObject Method. You may also want to read: Access delete table records Access VBA delete Table In Access VBA, deleting Table can be done by DoCmd.DeleteObject Method. It is an extremely simple and straight forward, the syntax is as below. In order to delete Table, use acTable in the ObjectType argument. DoCmd.DeleteObject(ObjectType, ObjectName) Name Requ...
Read More

Access VBA import txt using DoCmd.TransferText Method

This Access VBA tutorial explains how to import txt using DoCmd.TransferText Method in one Table or separate Table. Microsoft Access - import TXT using DoCmd.TransferText Method In my previous post , I explained how to use DoCmd.TransferText Method to export queries to files such as txt, this tutorial explains how to import txt into Table. First prepare a TXT file such as below Then import the txt file manually. Before the final step, create a specification (which field is what data ...
Read More

Access VBA create Query using CreateQueryDef

This Access tutorial explains how to create Query in Access VBA using CreateQueryDef Method. You may also want to read: Change Query criteria Access VBA create Query Sometimes we don't want to create Query in Query Design View, because you may create a Query with criteria depending on a variable. To create Query in Access VBA, you can directly write a SQL statement in Access VBA, and then create a Query using the SQL statement with CreateQueryDef Method. Syntax of CreateQueryDef expres...
Read More

Access Excel VBA copy workbook or file

This Access Excel VBA tutorial explains how to copy workbook or file. You may also want to read: FSO File Methods Worksheets.Copy Method to copy worksheet Access Excel VBA copy workbook or file There are two common ways to copy workbook or file FSO.CopyFile Method FileCopy Function I have explained how to use different FSO Methods in my previous post, click to see more details. Using FSO.CopyFile Method to copy workbook You should be able to run FSO in Excel 2013. If you fa...
Read More

Access Excel VBA delete all workbooks in folder

This VBA tutorial explains how to delete all workbooks in folder using Access VBA and Excel VBA. Access Excel VBA delete files in folder Suppose you want to write a Macro to export files to a folder. There could be problem if the folder already contains the files you want to export. To avoid this, you probably want to delete the folder and create a new folder before exporting the files. Alternatively, you can also delete all files in the folder. In order to delete files, you can use FSO Fil...
Read More

Access Excel VBA delete folder if folder exists

This tutorial explains how to use Access / Excel VBA to delete folder if folder exists already. Access Excel VBA delete folder if folder exists Suppose you want to write a Macro to export files to a folder. There could be problem if the folder already contains the files you want to export. To avoid this, you probably want to delete the folder and create a new folder before exporting the files. Alternatively, you can also delete all files in the folder. In order to delete a folder, you can u...
Read More

Access VBA check if Query is empty

This Access tutorial explains how to check if table or Query is empty in Access VBA. You may also want to read: Microsoft Access VBA Export all Query to Text File Access VBA check if Query is empty In Access VBA, there are SQL related Functions that simulate SQL. Access DCOUNT Function is one to simulate SQL COUNT. To count the number of records in a Query, we can use * in the first argument of DCOUNT Function. For example, the below VBA counts the number of records in Query1 DC...
Read More