The main complications are that the output file requires fields from several tables, and there are some rather long and complicated calculated fields to be included as well. My choices seem to be :
1) Create a complex query, including the calculated fields, and use DoCmd.TransferText
2) Create a report and then use TransferText
3) Use DoCmd.OutputTo (I haven't looked into this to see if it has any benefit)
4) Create an intermediate, temporary, Table and then run a simple query to output it using TransferText.
I'm recently added the CalendarControl 9.0 into some combo boxes in order to quickly input dates - however only the dates are then added, not the day of the week. The day of the week would be really useful if it was visible as the form is outputted to a HTML page for our intranet for other staff to see.
My (relevant) code at the moment is as follows:
-------------------------------------------------
Option Compare Database Option Explicit Dim cboOriginator As ComboBox
Private Sub cboStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Set cboOriginator = cboStartDate
ocxCalendar.Visible = True ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then ocxCalendar.Value = cboOriginator.Value Else ocxCalendar.Value = Date End If End Sub
Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Set cboOriginator = cboEndDate
ocxCalendar.Visible = True ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then ocxCalendar.Value = cboOriginator.Value Else ocxCalendar.Value = Date End If End Sub
Private Sub Form_Load() ocxCalendar.Visible = False End Sub
Private Sub ocxCalendar_Click() cboOriginator.Value = ocxCalendar.Value cboOriginator.SetFocus ocxCalendar.Visible = False Set cboOriginator = Nothing End Sub
I have a form with subform that uses colour as background colour for all fields on the form, and also a very light background for the whole form. This outputs very well to PDF, retaining all of the layout etc.
However, consisting of over 100 pages I do not want any colour at all in the printed report, no do I want the colour converted to black or grey. Inkjet cartridges are just too expensive!
Is there an easy way to remove all colour before printing or do I have to design another report?
how to write VBA to extract data from .msg files and import that data into a table in my database.I have over 5000 .msg files of which I need to extract the following information:
First name: Tim Surname: O'Rourke Street & Nr: 399 Upper Eastern Green Lane City: Coventry
[code]...
The field headings are all in black bold and the required data come after the colon, I have name the fields in my database exactly the same but using the normal naming conventions:
I am trying the get specific data out of an XML file. I managed to access a nodelist but I need more data.
This is the XML file:
Code:
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="removed due to #posts"> <CstmrDrctDbtInitn> <GrpHdr> <MsgId>006-2012-11-09-12:21:47</MsgId> <CreDtTm>2012-10-12T12:21:47</CreDtTm>
[Code] ....
This is the code to start with:
Private Sub NameSpace_Click() Dim strFile As String Dim xDoc As DOMDocument Set xDoc = New DOMDocument Dim Nodes As IXMLDOMNodeList Dim xNode As IXMLDOMNode
[Code] ....
The extra data I need are the IBAN and Ustrd field. But they are on a different level in the XML.
Where the word Author= appears to extract the data between the double quotes, so in the above case I want to extract "All Saints" excluding the double quotes.And then where Title= appears extract "On & On", again excluding the double quotes.So I would end up with data in my table looking something like this
strArtist [Author] strSong [Title] strGenre [Genre] strYear [Year] All Saints On & On Pop America Venture Highway Rock 1972 Amillionsons Misty Blue Pop 2002
I'm trying to parse the following into an Array by splitting the csv file using a "," comma separator. There should be 63 different data pieces in this File. When I do a count of them from the (ubound array) i only get 54. The last data piece on each row gets concatenated to the first data piece of the next line. Is there a way to stop this from happening? This is causing problems with working with the data.
Code beneath worked perfectly with Access 2003.Now we switched to Access 2010 and it generates a table where data isn't put into my 77 fields like before, but seperated into 1 field, separated by some ;;;.I am not good with programming.
Dim rst_data As Recordset Dim oldname As String, newname As String DoCmd.DeleteObject acTable, "TBL_import_TPXP_Radi_Evvd" DoCmd.TransferText acImportDelim, , "TBL_import_TPXP_Radi_Evvd", "N:APPLSHAREPRDQSIGMKTDISTPWBUSPB1815RADIEV IMPACT.CSV", False, ""
I have a table. Also i have a text file which some of the fields are matching with my table fields ( lets say field A and B ). Now, i need to do compare of these A & B of my table against A & B of the text file and give a result as follows;
1. "Field A" not in the table but in the text file (un-matching data to be shown ) 2. "Field A" not in the text file but in the table (un-matching data to be shown ) 3. "field B" mismatches
I've vba in Report onformat the vba code does some data copying to External Excel file (premade by vba).Now on first run, i got success.But on opening the excel file, it showed blank space + Error"File already opened"
No White Spreadsheet is shown with data to see into file, i created new excel file in windows, and inserted the vba created/exported file as an Obj.Now Obj is showing correct and full data with spreadsheet as normal view.
in Access i have made a report with data and now my goal is that if i click on a button the data will be exported to a existing Excel file under the other existing data so in row A6. Is this possible true a VBA code?
Question: Is it possible, using VBA, to determine the actual Excel file type without opening the file?
I receive data files from other departments. Seems like every time someone changes their download structure, I end up with file types that do not match the download extension (example: xlm file with a xls extension). The files can't even be opened because of this. I think I can fix it if I could figure out how to determine what the file type really is.
I recently upgraded a DB from 2003 to 2013 and ran into the following problem.
I have a button that opens a file dialog box and allows the user to upload a file to a predetermined location (and store the address as a hyperlink). I borrowed this code from someone else on here and modified it slightly.
In any case, the button still works, but now when it opens it doesn't have an option for "All files" under file types. So I can upload MS Office files, text files, etc., but not PDF files which are by far the most common types my users upload.
Here's my code and a screenshot is attached.
Private Sub Command35_Click() Dim dd As Integer Dim fileDump As FileDialog Set fileDump = Application.FileDialog(msoFileDialogOpen) dd = fileDump.Show
I am using the following code to select files using Microsoft Office's file dialog:
Public Function fTestFilePicker() As String Dim fdFileSelection As Office.FileDialog, lstrFileName As String Const kInitialFile = "F:TestbedTest.txt" Set fdFileSelection = Application.FileDialog(msoFileDialogFilePicker) With fdFileSelection .AllowMultiSelect = False
[Code] .....
When I execute it, the file picker goes to the right folder but does not highlight the file test.txt even though that file name shows in the File name text box. Is there any way to correct this?
I often create contract using mail merge. I have an access file that I want to use as data source for word file. But it does not automatically.
Please download the attached file !
If there are 1 customer and 1 property, I do not need to do anything. Conversely, if there are many customers and many properties, I take time to manipulate.
Firstly, I open the word file. I have to copy and paste paragraphs that I want. Highlight of the original paragraphs is blue.
Secondly, I click 'Insert Word Field' -> select 'Next Record'.
In short, I wish to use VBA in access file to automatically perform the steps that I have outlined.
I have a command button that outputs a report to PDF and saves it according to the Name in the NAME_OFF field. However, it saves all the records from the table in each PDF. I need to get each record to save individually.
Here's my code:
Private Sub CreateNotifications_Click() Dim dbsOfficerMgmt As DAO.Database Dim rstBoardResults As DAO.Recordset Dim strName As Field Dim strBrc As Field Set dbsOfficerMgmt = CurrentDb
I'm having another one of those days but I'm getting a file path and file name from a dialogbox and forgotten when the VBA property is to return the full file path and file name.
This code works fine for return the filename only:
Code:
Private Sub TEST() Dim f As Object Set f = Application.FileDialog(3) f.AllowMultiSelect = True If f.Show Then For I = 1 To f.SelectedItems.Count MsgBox Filename(f.SelectedItems(I)) Next End If End Sub
Instead of using 'Filename' what else can I use to return what I need?
I have opening a csv file from access changing the date to a number and then linking it to access and then doing a lookup.Problem is the lookup only works if i open the csv file and go to saveas and click yes on the message attached and then when i close the csv it makes me do this once more.
If i do the above it will work but if i dont, the lookup wont work.i dont want the user to have to do this to the files.
Code: Private Sub LoadRef2Cal_Click() On Error GoTo Err_LoadRef2Cal_Click Dim s As String Dim i As Long Dim ExcelWorkbook As Excel.Workbook
I have searched the forums and I know that you can backup data in Access to Excel or another database. What I was wondering was if there was some way to backup your data to a backup file that you could import into another copy of the database on another computer (not on network). What are the options here?:confused:
I have a project in Access where I am linked to a .dbf IV file. This file is populated by another software and I use Access to manipulate query the data. This file that I am linked to is now 923 Mb and I can’t seem to reduce the size of it. I have run delete queries and a compact and repair. Any ideas on how to reduce this file size?
I receive a .txt file daily and want to import the information into a table. My problem is that the currency values in the .txt file do not contain a decimal. For instance $7.12 will come in showing as 712. How do I get Access to recognize it with the decimal?
Im developing a database for work, I would like to provide a link on a form to run an external program. The form is call frmProfile. The table is called tblProfile and the hyperlink field is called link.
I would like a diaglog box to appear where the user can browse for the file and select it. Ive found various scripts but with my vb skills being very basic its no wonder im getting no joy.
I should add... each record has its own associated file. Its cctv footage which runs from the cctv systems own proprietary software. So its an individual filefor each record not just a program.
In access i want to create a button that can export a form to a .pdf file i know this is possible true VBA, and i tried to google but all those vba codes do not work.
I'm trying to put together a few lines of VBA code to export a report called "Rework Label Report" to a specific network location in PDF Format, I have already achieved this level of code and it works fine (code below); however each report has a unique number in the database [ID] which I would like included in the title of the PDF when exported and saved?
Code so far:-
Private Sub Command20_Click() Dim stReport As String Dim stSubject As String
[Code]....
Me!Combo3 is a combobox on form which selects the number of the report to be viewed ,the user then sees a preview of their chosen report and then clicks Cmd20 to export to PDF, currently the file is named Rework Label Report when saved.
I have a query that opens a listbox in a form. In the listbox I want to add a doubleclick event that opens a pdf document with the selected record in it. The record is in column 1 of the listbox.
I can't use the FollowHyperlink method of the colecction application due the record in the column is a Key. I am not sure if FollowHyperlink method can be used in a listbox
I have been checking codes in the web and I found this:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long ShellExecute Me.hwnd, "open", "D:SebDesktopGA-BDpdf est.pdf, "", "", 4"
However, I don't know how to organize the code in a logic way in Sub End Sub. Neither I don't know if the code is for the doubleclic event in the list box or a Module. If is for a module I don't know how to write the code in it.
Code: Public Shared Sub Main() Dim path As String = "c: empMyTest.txt" ' Create the file if it exists. If File.Exists(path) = False Then File.Create(path)