The Autoexec macro is a special macro which is executed automatically whenever the database is opened. Therefore I juse include the RunCode action within the macro to call my VBA code. As I was saying before, I am looking for something similar except executing before the application closes.
There are no application events in Access? But I've used the AutoExec macro to execute VBA code at the start when MS Access loads. So I thought that there should be a macro of some sort that executes VBA code before the application closes.
Suppose my CSV file forms a table like this:
COL_1,COL_2,COL_3
a,b,c
d,e,f
I want to import the csv file into the following table structure in MS Access:
COL_2 | COL_1 | COL_3
----------------------
b | a | c
e | d | f
----------------------
How can I create a specification...
I have an .sql file which is about 75MB in size. It consists of INSERT statements with the values I need to import into an Access table. Is there an easy way to import this on the fly like via a DoCmd statement or should I just parse the file line by line and execute these insert statements to...
I did the following:
DoCmd.TransferText acExportDelim, , strName, strExportName, True
but it won't prompt me for where I want the file to be saved (since i specified a filename). Is there a way to get the window to pop up along with my default file name shown in the window?
I would like to know how I can export to CSV format using the DoCmd.OutputTo function in VBA. I know how to do it in .xls format but not .csv.
As well I know that when a file name is not specified in the arguments, a window will popup asking you where you would like the file to be saved in. How...
Here is my current situation:
- Creating an Access app which relies on a series of Excel spreadsheets, each of which contains serveral worksheets.
- Given a form, user inputs a set of values, these values are then used to query the set of worksheets within the spreadsheets and generates a set...
Okay, I parsed out the date from a file which has NO relation with the date formats in VBA or whatever.
Tue Aug 24 21:00:00 2004 <-- taken from a data file, and inserted into the MS Access db table (that is only one of the files in the record)
All I want to know is if there is a format in VBA...
I am getting data from a field which contains this
Tue Aug 24 21:00:00 2004
I translated it to Tue 9:00 PM in VBA.
i.e Wed 1:00AM - Tue 6:00 PM returns 25200 because theres a 7 hour difference between them, hence 7*60*60 = 25200 secs.
Basically I would use
DateDiff("s","Tue 6:00 PM", "Wed...
Hello,
Suppose I have Tue 9:00 PM
I want to do a subtraction and return the number of seconds.
i.e Tue 9:00PM - Tue 6:00 PM returns 180
Also consider rollover
i.e Wed 1:00AM - Tue 6:00 PM returns 25200
Thanks.
I just found out that I could utilize DateDiff(), DateAdd()
however I want to know how to add days as well..
i.e Sat + 1 -> Sun, Sun + 2 -> Tue
Thanks.
Let's say I have some data I parsed. And the time format is the following:
hh:mm:ss (24hr format)
i.e 15:13:09
I want to subtract the two times and get an overall duration value.
i.e 10:00:00 - 9:30:00 = 00:30:00
or something of that nature.. thanks.
Here's the actual function, it just returns the collection. I just want to know how to deal with nonexistent keys (instead of being prompted with an error i want to assign an empty string)
i.e someVar = myCollection("12312")
someVar would be ""
Private Function getLookupTable(ByVal strType As...
Hello,
I have a function which contains two different collection objects. Given the name and key it will return the value if it exists or nothing if it doesnt. However, VBA prompts me with an error if we attempt to retrieve the value with a non existent key. I was wondering how to get around...
I am trying to convert my Access 2000 mdb to 97 and run the modules and found that there are some problems with using the split() function. Its telling me that it doesnt exist. Do I have to implement my own Split() ? Thanks.
Hello,
I have a function in a module which executes to do stuff while reading a record set. It also opens a form which shows the progress of the record reading, however it is not refreshing until records have been all read.
Public Function fCheckRating()
Dim db As DAO.Database
Dim rst...
Thanks, that helps.
I have another problem now. Let's say I attempt to lookup something that is not in the table, I want to be able to set my variable to "" if it fails to lookup a value from the given key. However, VBA chooses to prompt an error to me. I was wondering how I can catch the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.