Modules & VBA :: Function To Find ACCDB File Date Created?
Jun 5, 2014Is there a function I could use to find the date listed in the "date created" property of an Access file?
View RepliesIs there a function I could use to find the date listed in the "date created" property of an Access file?
View RepliesI've got the forms and queries in one .accdb file and my tables in a separate .accdb file. The forms file links to the tables in the tables file. The tables file resides in a folder called simply enough C:acc_tables and thats where i browsed to (obviously) when i set up the linkage.
One of the users does not wish (for whatever goddamn reason) to create a C:acc_tables file to stick the tables file in , and wants the tables file in some other folder.. Unfortunately this user does not have the skills to delete the existing links and re-link to the tables file after putting it in the folder he wants.
Where in the file that holds the forms and and queries do i find the path setting to the tables linked file? Can it be changed without deleting links and then re-linking?
I have a field (SNumber) which is a text field and contains records that have a number which sometimes also have 2 letters on the right. ( examples: 1, 2, 3CD, 5, 6 HD). I am using the Right function in a code I am writing.
If Right (SNumber, 2) = "CD" then
.....rest of code here
I would like instead of stating actual letters to code "any 2 digits". Can this be done and what is the correct code for any digits in this instance?
I have a form with couple of textboxes bound to a table. When the user opens the form to enter records, i want to write a function that would go through the textboxes to check whether the textboxes are left NULL. Now i can write code on button click for each form, but i was wondering if its possible to write a function that could be called for each form that i have to check for null values.
View 7 Replies View RelatedI have a database with extension .accdb. When I open it, everything is locked. I can't access VB Editor, Navigation Pane, Ribbon, nothing. It just opens a form and the only thing that can be edited are the text boxes on the form. I can't use Shift when opening it, that does nothing. It does not prompt for a password when opening.
View 13 Replies View RelatedCode:
Private Sub Form_Open(Cancel As Integer)
cboDateStart.Value = Format(Now() - 7, "short date")
...
End Sub
When I run procedure the Format is highlighted and popup error message:
Compile error: Can't find project or library
I'm looking for some type of custom function that will search a specified column for any keywords listed inside another table.
I can run a query on each keyword individually, however there are 50 and it takes a long time each time I do it. I was hoping to write in a function for that column and it would just select all records that match.
These would all need to be a "like" with an " * " on each end of the word.
With SQL it would look something like:
Code:
select a.address1
from main_tbl as a
where a.address1 like '* north *'
or a.address1 like '* park *'
or a.address1 like '* south *';
I just want it to read each of the table values instead of hard coding them and the column name would be the function name so it can be used in any column I specify. I'm just not sure how to incorporate this into a custom function.
I'm trying to find all the table names inside an external access file from a path.
I have a code for the user to select a file which return a patch to the file.
Then I need to find all the tables names from that file and append them to a list.
so I them can input them into a code and link the tables.
here is the code to get the file patch:
Code:
Function getFileName(path) As String
Dim f As Object
Dim varFile As Variant
Dim path
Set f = Application.FileDialog(3)
[Code] ......
I want to find out the last 6 months date from todays date. So as todays date is 27th january 2015 so the code should give me the date which is 6 months back from todays date so it will be something like 27th July 2014.
View 1 Replies View RelatedI'm trying to write a function to unzip a file (working off Ron de Bruin's code here)..The function should take the path of the zipped file as an argument and return the path of the unzipped file (extracting to the same folder)
Code:
Public Function UnZipFile(strFile As String) As String
On Error GoTo ErrorHandler
Dim objFSO As Object
Dim objShellApp As Object
Dim strUnzipped As String
[code]...
But the code has no effect (i.e., I'm still left with just the zipped file in the folder, not the unzipped contents?) strFile is a legitimate path to an existing .zip file which contains a zipped .xls file
Code:
objShellApp.Namespace(.GetAbsolutePathName(strFile)).Items
...but found that the .Count property was 0?I've done several searches on how to unzip files using VBA and this seems to be the universally accepted method.
There is a manual process I'd like to automate. Instead of the user manually importing an external file into a table, I want a function to grab the most recent file in a particular directory. Is that possible?For example, I have a table called Input, and I want to append the file I just saved on my network, which in this case is G:Files2014TA_140928_011007.txt. The two ways to know which file to use is that the date is part of the filename (TA_ YYMMDD_ 999999. txt), and also the Date Modified attribute.
I am aware that if the user needs to work the files out of date order, he/she cannot use this code.
Hi All,
For some strange reason, a replica db is being created along side the original. I don't believe it's a back up since the name back_up usually appears in the file name. I've seen it happen once when the proper mdb file was opened and then noticed the new db was created (always called db1.mdb). It's a permanent file mdb file and not the record locking icon. I remember over the summer someone posted a similar problem but I haven't been able to locate that thread. Any suggestions?
Thanks
One of the users of my databases uses a laptop. Whenever he exits the database, he leaves behind a trash file. Does anyone know what causes this?
View 2 Replies View RelatedI'd like to further automate our invoicing system and need a field which has the last day of the month an item was completed.
Currently we have a field in the table called [Date Done]. I'm planning on adding a further field [Tax_Point].
I'd like the field to select the [date done] value and enter the final day of that month, unless, the final date of that month is in the future. in which case it would need the current date.
We create invoices at sporadic times of the month, and in the next month for the previous month; hence the need for a system date check.
Memo field is called [Notes] and data is like this...
5/05/14 - Perry was on another call. LM 2/05/14 - Perry only at centre in the mornings, need to speak to him before sending samples. 13/06/13 - Perry in a meeting. lm 30/05/13 - See Little Hampton Early Learning - s/w Perry, has already received sample and info 29/05/13 - s/w Aspi, said to cb tomorrow and speak to Perry
I want to find each date in the Notes field so I can split the memo field data into another table where the memo field will become multiple records that hold date, text and customer/prospect ID fields. The customer table was easy because there was a <Div> tag before each date. However in the Prospects table there are no tags so how to change my vba code to search for each date before I split off the data.
Here is the part of the VBA code I used to find the <Div> tag in the customer notes field. How to find each date in the memo field? The date is in d/mm/yy format?
If Not rst.EOF Then
Do
StrSplit = Split(rst![Notes], "<Div>")
For x = 1 To UBound(StrSplit)
I am trying to connect to an access database format 2003 from my access 2007 database. I would like to create a recordset from a table in the 2003 database and bind it to a listbox in my 2007 database.I tried to the following code that didn't work.
Code:
Dim DNHConn As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim connStr, xSource, xSys, xUsr, xPsw
On Error GoTo errH
[code]....
When I try to execute that code, I get an error that the apllication can't start because the worgroup file is either missing or opened exclusive by another user.
I'd like to know if it is possible to copy an object (typically forms, reports and queries) by code from the acces file I'm woriking in to another one that is not opened.
View 1 Replies View RelatedI have a database (accdb) out of which I want to generate accdr files of which user can only access / view the reports section ONLY. Looking for VB code which will generate employee wise (or any criteria) accdr files?????
View 2 Replies View RelatedI have some vba where I'm importing a text file and splitting it out into a table. For the most part its working just fine.
But I have a line of data that I need to pull out the string right after "Old" - Murphy and right after "New" ZMurphy
Acc# : 111111 This is test data, Person : 22222 Old Murphy New ZMurphy
I'm thinking Instr() could do this but I'm unable to get it to work.
I am using Access 2010...
I want VbA code to find a date 1 less than todays date taking into account weekends/Bank Holidays.
View 8 Replies View RelatedI have a table with only two fields and one record: BegDate and EndDate (beginning and end date of the reporting period respectively). I also made a function with variables that look up those values for use as a date parameter in a query.
Here is the code:
Option Compare Database
Option Explicit
Public Function getCurrentRepDates() As Date
Dim dtBegDate As Date
dtBegDate = DLookup("BegDate", "tblCurrentRepDates")
[Code] ....
I am getting a syntax error for the line marked red. How can I use "Between" function in VBA code? Access 2010
Hello,
i would like to add in my database two fields: date update and date created automatically, but how?
thanx
sorry for my english...
windowsXP
access 2007
So I currently have a module which automatically backs up my database to a separate file everyday on open of my database.
If is it possible to create a function which will allow me to delete these backups after a certain amount of days (eg 30 days). They all have different file names based on the time that the backup was created but have the same extension of "*.accdb". I ask because it stores EVERY backup so the storage space required will soon build up unless manually deleting the files which is not what my client will want,
I have tried using the "Kill(pathname)" function but have had no luck yet!
If possible, I would like this to be done automatically either on open or on close of my database.
Would this be done with a module?
What I would like to achieve via code on a button. From the table orders
Code:
orderDate orderID ref name amt vat
02/02/2014 56789 01 magdi 600 100
22/06/2014 12122 01 magdi 654 100
22/06/2014 65897 02 simon 250 159
22/06/2014 12345 02 simon 156 140
23/07/2014 56781 01 magdi 400 250
01/08/2014 12457 01 magdi 250 900
01/09/2014 56787 02 simon 126 500
02/09/2014 56781 04 peter 400 250
02/09/2014 12345 02 simon 450 122
02/09/2014 65897 04 peter 250 231
02/09/2014 12122 05 hargr 654 100
02/09/2014 79457 05 hargr 254 200
I need to create csv files from the above based on unique date and ref and with filename showing date and ref. So from the above we should get 9 csv files in this format
02/02/2014-01.csv
22/06/2014-01.csv
22/06/2014-02.csv
23/07/2014-01.csv
01/08/2014-01.csv
01/09/2014-02.csv
02/09/2014-02.csv
02/09/2014-04.csv
02/09/2014-05.csv
How to produce the above result ...
I want to save NOW() (i.e. Date and time) into an event log file. But I just cannot work out the syntax. My insert statement works fine without the date field in, but fails on a syntax error (3134) when I include it.
strsqlac = "INSERT INTO EventLog ( EventTime, User, EventType, EventMessage, DocRef, AutoSeq, CoCode ) " & _
" Values ( '" & Now() & "', '" & GlobUser & _
"', '" & Mess2 & _
"', '" & Mess1 & _
"', '" & Docref & _
"', " & AutoSeq & _
", '" & CoCode & _
"' );"
... it's the first column, EventTime that is the issue. I have tried several different ways of wrapping it in the VALUES () without success.
My database field EventTime is defined as a General date which Access 2007 tells me will give me date and time. That's what I want.
The Value formats I have tried (currently showing as 'NOW()' above, are ...
#NOW()#
#'NOW()'=
'#NOW()#'
and (as I say) 'NOW()'
I have a split database with a frontend that I semi-regularly update (when one of my users finds a bug I never would have thought for looking for). On my menu screen i have a text box that says: "Last Updated: ##/##/####".
At the moment I manually update the date every time I update the frontend.
Is there a way I can use the DateModifed property of the .mdb file for the frontend as the date in my textbox using VBA?