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...
More

Access VBA NPV Function to calculate Net Present Value

This Access tutorial explains how to use NPV Function in Access VBA to calculate Net Present Value. You may also want to read: Excel NPV Function Net Present Value Net Present Value is to calculate the present value of future cash flow. For example, your client will give you $10000 when the project completes after 1 year, assume there will be inflation, the future $10000 will be less than the present $10000. Assume the inflation is 4%, the present value of $10000 is 10000/(1+4%) = 9615.3...
More

Get exchange rate using VBA Access Function

This tutorial demonstrates how to create a VBA custom function (UDF) in Microsoft Access in order to get the real time exchange rate. You may also want to read Get Foreign Exchange Rate in Excel Get exchange rate using VBA Access Function Yahoo Finance is designed in the way to facilitate you to get data. You can establish a connection to Yahoo and directly get the exchange rate using User Defined Function. Open Access, press ALT+F11 > Tools > References > enable "Microsoft W...
More

Access VBA DoCmd.TransferText Method

This Access VBA tutorial explains how to import and export Access Objects to text using DoCmd.TransferText Method. You may also want to read Access VBA Export all Queries to Excel Syntax of  DoCmd.TransferText Method DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage) Name Required/Optional Data Type Description TransferType Optional AcTextTransferType The type of transfer you want to make. You can import data...
More

Microsoft Access VBA Export all Query to Text File

This Access tutorial explains how to use Access VBA to export all Query to Text file. You may also want to read: Microsoft Access Export all Queries to Excel Access VBA DoCmd.TransferText Method Export Access Objects to Text (non VBA) There are two kinds of export that we can use to export an Access object to Text file. Assume that we want to export Query1 to Text. Right click on the Query > Export > Text File   This page has a check box Export data with format...
More

Microsoft Access Export all Queries to Excel

This Access tutorial explains how to export all Queries to Excel. You may also want to read: Access VBA auto generate mass report by group to Excel Microsoft Access Export all Queries to Excel Assume that you have created three Queries in Access database, all you want to export them to Excel.   Press ALT+F11 > insert a Module > paste the below code Public Sub export_Excel()   Dim db As DAO.Database   Dim qdf As DAO.QueryDef   Set db = CurrentDb()   For Each ...
More

Run Access Macro using RunCode

This Access tutorial explain how to run Access Macro using RunCode. Run Access Macro Assume that you have already written a Sub Procedure helloWorld(). To run the Macro, you can press ALT+F11 and run the Procedure by pressing F5.   Alternatively, go back to the Access Windows, double click on the Module on the left hand side and run the Procedure by pressing F5. If you are writing a Macro for users, they probably have no idea how to run it. Instead, we should create a but...
More

Add Auto number in Access Query

This Access tutorial explains how to add auto number in Access Query using Access VBA Function. Add Auto number in Access Table In Microsoft Access, go to Design View of a Table and define the Data Type of a field as AutoNumber   Go to data view of the Table, each row of data is assigned a sequence number in ascending order. However, we cannot add the AutoNumber Data Type in Query Design View, therefore we need to workaround to add auto number in Access Query. Add Auto n...
More

Access Excel extract file name from file path

This Excel tutorial explains how to extract file name from file path using VBA and without VBA. Excel Access VBA extract percentage from text Access Excel VBA extract number from text or extract alphabet Excel Extract Time from Date Time or Extract Date Excel extract file name from file path Assume that you have a file path such as C:\Program Files\Google\GoogleToolbarNotifier\a.jpg If you want to extract file name a.jpg from the path in Excel, first we need to think about how to de...
More

Excel Access VBA extract percentage from text

This Excel / Access tutorial explains how to extract percentage from text. Access Excel VBA extract number from text or extract alphabet Excel Extract Time from Date Time or Extract Date Access Excel extract file name from file path Excel Access VBA extract percentage from text Recently I got a report that contains percentage but it is mixed with other text. For example, Salary increased by 10% We are unable to do any calculation unless we extract the 10% or 10 out from the text. ...
More