I have several queries that make a new table for export. I need to find a way to format the date field in the exporting table before I output it.
Here is what I am guessing at: -
Private Sub cmdAWBCSINGLE_Click()
-
'On Error GoTo RUNAPP_ERROR
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryAWBCTEST"
-
DoCmd.OpenQuery "qryAWBCSINGLE"
-
Table!tblAWBC![Street Date].Format = "YYYYMMDD"
-
DoCmd.OutputTo acOutputTable, "tblAWBC", "*.xls", , YES
-
txtLOC.Value = "AWBC Single Title Query Completed ---" & FullExcelPath
-
Exit Sub
-
-
RUNAPP_ERROR:
-
End Sub
-
Here is the piece I need help on (the code obviously does not work):
Table!tblAWBC![Street Date].Format = "YYYYMMDD"
The exported file needs the date field formatted this way. It goes into a third party system and does not validate without it. Opening up the spreadsheet and reformatting does not solve my problem...
Thanks for any help.
10 6912
I have several queries that make a new table for export. I need to find a way to format the date field in the exporting table before I output it.
Here is what I am guessing at: -
Private Sub cmdAWBCSINGLE_Click()
-
'On Error GoTo RUNAPP_ERROR
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryAWBCTEST"
-
DoCmd.OpenQuery "qryAWBCSINGLE"
-
Table!tblAWBC![Street Date].Format = "YYYYMMDD"
-
DoCmd.OutputTo acOutputTable, "tblAWBC", "*.xls", , YES
-
txtLOC.Value = "AWBC Single Title Query Completed ---" & FullExcelPath
-
Exit Sub
-
-
RUNAPP_ERROR:
-
End Sub
-
Here is the piece I need help on (the code obviously does not work):
Table!tblAWBC![Street Date].Format = "YYYYMMDD"
The exported file needs the date field formatted this way. It goes into a third party system and does not validate without it. Opening up the spreadsheet and reformatting does not solve my problem...
Thanks for any help.
Immediately prior to the Export, Format the Field exactly how you want it. Be advised that the change will persist (is permanent), so you may wish to revert back to its original Format after the Export. - CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
DoCmd.OutputTo acOutputTable, "tblAWBC", acFormatXLS, , True
Immediately prior to the Export, Format the Field exactly how you want it. Be advised that the change will persist (is permanent), so you may wish to revert back to its original Format after the Export. - CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
DoCmd.OutputTo acOutputTable, "tblAWBC", acFormatXLS, , True
I am getting a property not found error when it runs...
I am getting a property not found error when it runs...
This is a time sensitive project, so I am bouncing this back up the list.
This is a time sensitive project, so I am bouncing this back up the list.
I'm not sure what the problem is, the code has been tested and is functional. Try checking you syntax.
I'm not sure what the problem is, the code has been tested and is functional. Try checking you syntax.
First Error:
When I run this I get: "Item Not Found in this Collection" -
CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
Second Error:
When I tried this, because it looked like a typo I get this error: "Property Not Found" -
CurrentDb.TableDefs("tblAWBC").Fields("Street Date").Properties("Format") = "YYYYMMDD"
-
First Error:
When I run this I get: "Item Not Found in this Collection" -
CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
Second Error:
When I tried this, because it looked like a typo I get this error: "Property Not Found" -
CurrentDb.TableDefs("tblAWBC").Fields("Street Date").Properties("Format") = "YYYYMMDD"
-
ADezii,
The code runs when I go into the table, define a format (like long date), close the table, and then run the code.
It looks like I have to go and create the property first. First time trying, so any pointers would be most helpful.
Nathan
On this line -
CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
you've got an unmatched square bracket before Street Date! Unmatched brackets re never happy!
Linq ;0)>
On this line -
CurrentDb.TableDefs("tblAWBC").Fields("[Street Date").Properties("Format") = "YYYYMMDD"
-
you've got an unmatched square bracket before Street Date! Unmatched brackets re never happy!
Linq ;0)>
Linq,
I think we have that fixed. Problem is now I have to create the "format" property in the code, but have no experience with that. Any advice?
Nathan
ADezii,
The code runs when I go into the table, define a format (like long date), close the table, and then run the code.
It looks like I have to go and create the property first. First time trying, so any pointers would be most helpful.
Nathan
As Linq pointed out, the only problem should be the missing right bracket in the [Street Date] Field. It should run now: - CurrentDb.TableDefs("tblAWBC").Fields("[Street Date]").Properties("Format") = "YYYYMMDD"
As Linq pointed out, the only problem should be the missing right bracket in the [Street Date] Field. It should run now: - CurrentDb.TableDefs("tblAWBC").Fields("[Street Date]").Properties("Format") = "YYYYMMDD"
Hey All,
Let me try to explain. The code does run fine, but only after I have opened up the created table, insert something in the "Format" properties box, close the table, and then run the code.
It does not work if I do not do these steps. The field does not have the "Format" property attached to it prior to these steps, so if I run the code it does not find the property "format".
I think that before this line of code, I need to either create an instance of the property "format" attached to the field, or something....it is frustrating.
thanks for all your brain power so far.
Nathan
Sign in to post your reply or Sign up for a free account.
Similar topics
by: peashoe |
last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an
exact date format in the text field (txtDDate). My problem is I need
some javascript that sets an alert that does not allow them...
|
by: usenet |
last post by:
I have inherited a table where date information was saved from PHP as a VARCHAR.
(Sigh.) This means that the so-called date fields look like this :
August 1, 2005, 9:09 am EDT
October 13, 2004,...
|
by: lsy |
last post by:
i wonder how can i order my statement interm of "ORDER BY FORMAT(Date, 'mmmm')" with using this it will order by alphabethical but i want it order by month... i had try "ORDER BY FORMAT(Date, 'mm')"...
|
by: Fran Zablocki |
last post by:
I have a process that exports an Access table to a comma-delimited
text file. One of the fields that is exported shows the date it was
exported, using the Date() function. In the Access table, the...
|
by: Stewart Allen |
last post by:
I'm trying to filter a table that has 2 date fields, the first date will
always have a value but the second will only occasionally has a value. Each
date field also has a corresponding text field...
|
by: S. van Beek |
last post by:
Dear reader,
By a Date field with Now() as default value the content of the field is date
plus time.
As I need a filter in a query on date only (excluding time) I invented the
following...
|
by: Paul |
last post by:
I am trying to insert a date into a mysql table but everytime I attempt it
the date field is always empty.
The field is of Date type and the date in code is in European format
dd/mm/yyyy.
...
|
by: G Gerard |
last post by:
Hello
I am having some problem comparing dates with the SQL statement below
MySQL = "SELECT Format(Date, 'yyyy/mmmm/dd') as FROM TblDates WHERE
_
Format(Date, 'yyyy/mmmm/dd') =...
|
by: sparks |
last post by:
I am trying to find valid records in a table
but I must compare a date field to a date stored in the table
I can see where this is wrong (ok I guess its not text)
"= """ & Me.date & """"
so...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |