I am trying to export a table from access to excel. It has a couple of columns with times in and when excel opens it just shows 00/01/1900 for all the values.
Here is my query that creates the table for exporting:
Code:
SELECT tblRoadClosuresAdditionalDates.Reference, tblRoadClosuresAdditionalDates.DateOfClosure, CStr(Format([TimeFrom],"Medium Time")) AS TimeFromMod, TimeValue([TimeTo]) AS
TimeToMod, tblRoadClosuresAdditionalDates.NumberOfPeople INTO tmpAdditionDates
FROM tblRoadClosuresAdditionalDates
WHERE (((tblRoadClosuresAdditionalDates.Reference)=[Forms]![frmProgressRoadClosures]![sfrmRoadClosuresAdditionalDates].[Form]![Reference]));
You can see a couple of my attempts to handle this data above.
I am using this code to create my excel table.
Code:
DoCmd.OpenQuery "qryRCADditionalDatesFilteredExport"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "tmpAdditionDates", "xxxxxxxxxxxxxx", No
way to handle this field so that I get just the time in the medium time format appearing in the excel table.
I have an application at a client site which is split into two mdb files, a front end (forms, queries, etc.) and a backend (tables, data only).I have a query involving multiple tables, which creates an Excel Spreadsheet. Sometime after installing it at client site, it no longer works because the entire contents of the query itself are wiped out -- totally empty. When I open up the query in design mode, it is empty -- no tables, no columns, no select blank, empty.
I'm at the end of a long project that has one last step. I was hoping that someone here would be generous enough to help. I'm pretty much a novice at Access and am sure that my question can be easily answered. So here is the problem.
I have data that is loaded from a PDA to a form in Access. The data can then be viewed in a list box which is great. I also need to be able to save the data from the list box, using a button, as an excel spreadsheet. Is there anyone here that is willing to guide me to a solution?? Thanks in advance -Tom
The time difference in access query works very fine in 18:00 (Short Time) format , but when i export to excel it came out with "########" and the value is -0.14679132479
How to solve this problem , i keep trying but it doesn't work ....
Hi, It is a long time since I seriously used Access and I am a bit rusty. I am trying to create a databse to genealogical information and need a date format that will handle anything from 2007 way back to the 1600's. I seem to remember that MS software uses a numerical system for assigning dates but works from 1900 onwards. I am sure there must be a "fix" for assigning pre 1900 dates but cannot find a reference.
Is there anyone out there who has experience of this kind of problem who would be kind enough to offer some advice please ?
I have data that looks like this: 3-KJ56, 1-85L6. I am importing data from excel. (This was exporting from another inhouse database program into tabdelimited, into excel, ect)
There are times that I get data that is mistaken for a date:
1-5600 (jan-5600) This is how it is in Excel, before I load it up into access. I use an update Query to correct this mistake
Month([Datafield])& "-" & Year([Datafield])
BUT..... When Access sees years like "5600" it comes back as "2000" or "8956" comes back as "1956".
When I use the year() statement in Excel, it comes back with the correct year- but not access.
Is there a statement that will force Access to see the entire 4 digit year?
I'm using Access 2010's DoCmd.OutputTo in VBA to export reports to PDF. The "look and feel" of the PDFs are very important, as they will be distributed to clients of my company. I'm using special corporate fonts that are legally licensed for embedding as a subset. Two are .ttf (TrueType) and two are .otf (OpenType) fonts. The ttf fonts embed fine; the otf fonts do not, and the PDF viewer substitutes something it thinks is close (but really isn't). In the properties of the fonts in Windows Control Panel, the embedding properties are exactly the same for both.
Any way to force the fonts to embed? or any other workaround? Also, is there any way to edit-protect PDFs with VBA code? Or apply any other type of PDF security such as requiring a password to open?
I am trying to create a saved export on a table i have. However i want to filter so when i do the saved export it exports the table with the filtered result only.However when i filter my table and export it and save the export. The first export comes out with the filtered results but when i go to my list of saved exports and export it again, it doesnt come filtered and its just an export of the whole table.
We have small data dumps from a webservice delivered to us daily in csv format. I'd like to create a system where we can have the data automatically imported into either Access.
My idea is this:
1. CSV is downloaded to <x> folder.
2. Scheduled Task runs script to look in folder <x>
3. If CSV is found in folder <x>, import it's data into a fixed Access db->table.
4. Move CSV to an archive folder to avoid re-processing.
Is this feasible? How complicated would it be, and how to get it on track?
I have created user defined function for lastdayofweek, lastdayofmonth, and firstdayofmonth. When I apply this function to an expression in my query, it returns a julian date. How do I apply the format for the calendar date?
Maybe I am not calling my function correctly. Here's my functions below as well as my expression..
Function LastDayThisMonth() LastDayThisMonth = DateSerial(Year(Date), Month(Date) + 1, 0) End Function
Function FirstDayThisMonth() FirstDayThisMonth = DateSerial(Year(Date), Month(Date), 1) End Function
I'm merging a few databases together. They're fairly simple on their own but I'd like them as one big database. I read that I should import each access database into a new, blank one.
It all works fine, but none of the saved imports and exports come with them. Unfortunately, these imports and exports are relied upon quite heavily.
Is there a way to bring saved imports over from other databases, or will I have to rebuild each one?
I currently require a macro that takes the record and when clicked, it opens a form and displays this record. This is so that I can use it to click buttons and open existing reports based on the data and field that match the 'clicked' record.
I have to join multiple values into a string for summarizing data on reports and exports. This process in vba is taking up to 10 minutes to process and will get worse as the size of these reports grow.
My method so far is to query the individual items into a recordset, loop through the values, adding them to the string then return the string in the query.
Here is an example:
Public Function SO_Description(intSO As Integer) As String Dim db As DAO.Database Dim rs As DAO.Recordset Dim strSQLSelect As String SO_Description = "Profiles: " Set db = CurrentDb
I am trying to create an Access database where I can let the employees enter their time-in and time-out, at the end of their shift. I already created this function working, but running into another issue. Everyday, employees need to enter a break. Sometimes they take a break and sometimes they don't, if they work shorter hours. Thus, the break is not a default 30min and has to be enterd by the employee.
Below is the code I have to calculate the total hour:
txtCalcTime has the below code in control source: =Int([CalcTime]/60) & ":" & Int([CalcTime] Mod 60)
Control source for this form "FrmTimes" property, in which Txtcalctime resides:
QryTimes "QryTimes" query has the code below: SELECT TimeID, TimeIn, TimeOut, Brake, DateID, DateDiff("n",[TimeIn],[TimeOut]) AS CalcTime FROM EmpTimes;
This shows the total number of hours worked. But how can I make it to substract the break time entered by the employee in "txtbreak" on FrmTimes
I have finger print machine and i already connect to it and get all log.then i tray to get data and here is the code that im using
SELECT Format(CHECKINOUT.CHECKTIME,"dd/mm/yyyy") AS CDate, IIf([CHECKINOUT.CHECKTYPE]=I,Format(CHECKINOUT.CHECKTIME,"hh:nn:ss ampm")) AS StartTime, Format(CHECKINOUT.CHECKTIME,"hh:nn:ss ampm") AS EndTime, USERINFO.USERID, USERINFO.Name, CHECKINOUT.CHECKTYPE FROM CHECKINOUT INNER JOIN USERINFO ON CHECKINOUT.USERID=USERINFO.USERID WHERE (((Format([CHECKINOUT].[CHECKTIME],"dd/mm/yyyy"))='10/04/2014'));
I need a Select Query to display data on a form. When an order is appended to my table the field named Printed is updated with the time it was appended. When my form opens it needs to display the field Printed and a field I call MinutesFromPrint. This field needs to display the total minutes elapsed from the time in the Printed field to the current time. My expression is not working.
MinutesFromPrint: DateDiff("n",[Printed],Now())
Here are a couple of samples of my results when I run the query at 7:49 A.M.:
I have a default directory that will contain Excle spreadsheets. This spreadsheets have the name of the table i want them to create when they are imported in Access.
I want first to count and present to the user the number of the spreasheets. then import one name the table with the name of the spreadsheet and then process. When done move to the next one until there is no more in the directory...
I am having trouble getting the following code to load data from my Excel file "Book.xlsx" into my table called "ExcelDataBook":
Sub btnExcelImport_Click() DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "ExcelDataBook", _ "C:Usersdacampb1DesktopBook.xlsx", , "Sheet1!A1:B12000" End Sub
The Excel file only has one sheet "Sheet1' and has only 10,504 rows but this can vary so I set it in the code for 12,000 rows. The sheet has only two columns "A" and "B" with the first row of the two columns labeled "Store" and "Amount" and my tabel has only two fields "Store" and "Amount".My error reads: Run-time error '2391': Field 'F1' doesn't exist in the destination table 'ExcelDataBook.'
I'm writing to an excel file from two separate Access tables, for which I'm using two separate DAO.Recordsets in VBA.The first table has 190 columns, the second table has more than 66 columns, so more than 256 columns will be written to the excel file.So I'm not expecting any error due to any maximum of 256 columns, but still I'm getting an error while trying to populate the 257th excel-column:
Run-time error '1004': Application-defined or object-defined error.(The same VBA works fine when I use another table with less columns.)Even more strange: on another computer I did not get the error and I was able to populate more than 256 excel-columns.
Code:
Option Compare Database Option Explicit Dim xlApp As Excel.Application Dim xlWkb As Excel.Workbook Dim xlWks As Excel.Worksheet Dim FileNameOut As String Dim RowNr As Long Dim ColNr As Long
I have the following code, which works the way I want it to when I click the button the first time. However, if I close out the excel and click the button again, it errors at the line "ActiveWorkbook.Worksheets("Ref").UnProtect", with the message "Run-time error '91', Object variable or With block variable not set". I can not figure this out, why in the world does it work the first time, but not the second???
Private Sub cmdReport_Click() Dim path As String Dim XL As Object Dim oBook As Excel.Workbook Dim pic As Excel.Shape Set XL = CreateObject("Excel.Application")
I am trying to publish an Excel Pivot Chart, but keep getting Run Time Error 1004 - Application-defined or object-defined error...
I have tried the code 2 ways:
Code: Sub PublishChart() Worksheets("Historical_Pivot").Activate With ActiveWorkbook.PublishObjects.Add(xlSourceChart, _ Path & "" & "AWA" & "_" & "JAMALCO" & "_" & "Chart" & ".htm", _ "Historical_Pivot", "JAMALCO", xlHtmlStatic, "ABC REQ BACKLOG_2013", "") .Publish (True) .AutoRepublish = False End With End Sub
Code: Sub PublishChart() Dim wb As Workbook Dim ws As Worksheet Set wb = ThisWorkbookSet ws = wb.Sheets("Historical_Pivot") ws.ChartObjects("JAMALCO").Activate With wb.PublishObjects.Add(xlSourceChart, Path & "" & "AWA" & "_" & "JAMALCO" & "_" & "Chart" & ".htm", ws _ , "", xlHtmlStatic, "", "") .Publish (True) End With End Sub
I'm trying to export queries from access to excel using the DoCmd option. The code (see below) works to a point - it exports some of the queries before I get a run time error:
"31532: Microsoft Access was unable to export the data".
The worksheet tabs also do not pick up the query name but instead return what looks like a temporary ID (e.g. ~TMPCLP118431). Have tried different file locations and versions of excel but the same thing keeps happening.
Code: Sub ExportAllQueries() Dim qdf As QueryDef Dim db As Database
Is it possible that two mgsbox will Show up, where the user can put in the timeperiod.
The time period would be the starting day of the contract.
It's called inception_date
Code: Private Sub Befehl1_Click() Dim xlApp As Object 'Excel.Application Dim xlBook As Object 'Excel.Workbook Dim xlSheet As Object 'Excel.Worksheet Dim rstID As DAO.Recordset, tmpStr As String Dim rstGr As DAO.Recordset, strSQL As String
I using excel 2010 and access 2010. I have VBA script runtime error 3011 when running script. It has problem finding access report. First I was passing in as variable with the name. Then I used a script to pull in the report name from access and it is still failing with same error.
Code is shown below.
Private Sub Command29_Click() Dim reportname As String Dim theFilePath As String, FilePath As String, tempStr As String ' reportname = Me.My_DBTableName