It has been a long time since I have added a VBA post, so here is something that I had to quickly put together for a little project that I am working on this evening. I have a really large table with a bunch of fieldnames that I need to query through to make some sample data for another project. I thought that it would be easiest to quickly grab all of the field names from … [Read more...] about Get Column Names From Access Database Table with VBA
access
Save File With File Dialog In VBA | Access
A couple of years ago, I posted code for selecting a file with VBA. This example demonstrates how to use the file dialog to return a Save-As string. VBA File Dialog Save-As '-------------------------------------------------- ' File Dialog Save-As '-------------------------------------------------- 'NOTE: To use this code, you must reference 'The Microsoft Office 14.0 (or … [Read more...] about Save File With File Dialog In VBA | Access
VBA Export to CSV From SQL With Save-As in Access
Although not as common as exporting to Excel, some projects may have a need to export in .csv format. Here is my solution. VBA Export With User Defined SQL Query This example uses the QueryDef function. Basically, the user passes a SQL query in, the file dialog prompts for where to save-as and the export is completed. 'To use file-dialog, you must add a reference 'to … [Read more...] about VBA Export to CSV From SQL With Save-As in Access
How to Find Fourth Thursday of November in VBA
I recently built a project where I had to count business days by excluding weekends and US Federal holidays. In my previous post: , my example used hard-coded dates. This new example can be adapted and re-coded to find the date of any specific weekday or holiday of the year without the need to hard-code. Public Function dThanksgiving(curDate As Date) As Date 'Define … [Read more...] about How to Find Fourth Thursday of November in VBA
Simple Mortgage Calculator Function | Excel, Access VBA
There are a lot of ways to calculate a mortgage payment in Excel. I honestly haven’t made any attempts to calculate a mortgage payment in Access using standard functions. There has to be a way, but for fun, I thought that I would share a simple function. To use this function, insert it into a module. For Excel, make sure you save your Excel document as a "Macro-Enabled" … [Read more...] about Simple Mortgage Calculator Function | Excel, Access VBA