Problem With Module To Export Several Files To .rtf Documents
Sep 20, 2006
Here is my function :
Private Sub Commande4_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim BaseSQL As String
Dim strSQL As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT DISTINCT [Dealer/Distributor Number] FROM Query_Active_Dealer_List_Update")
Set qdf = dbs.QueryDefs("Query_Active_Dealer_List_Update")
BaseSQL = qdf.SQL
With rst
Do Until .EOF
strSQL = Left(BaseSQL, Len(BaseSQL) - 3) & " WHERE [Dealer/Distributor Number] =" & ![Dealer/Distributor Number]
qdf.SQL = strSQL
DoCmd.OutputTo acOutputReport, "Main_Report", "RichTextFormat", "C:Documents and SettingslarocmaDealer_Scorecards" & ![Dealer/Distributor Number] & ".doc"
.MoveNext
Loop
.Close
End With
qdf.SQL = BaseSQL
Set qdf = Nothing
Set rst = Nothing
Set dbs = Nothing
End Sub
The problem is in the line containing : strSQL = Left(BaseSQL, Len(BaseSQL) - 3) & " WHERE [Dealer/Distributor Number] =" & ![Dealer/Distributor Number]
If I let ![Dealer/Distributor Number] this way I get an error and no report generated. But if I put "[Dealer/Distributor Number]" in a parameter, and I enter the dealer numbers by hand, I get good working reports. Dealer/Distributor Number are not nul. Main_Report is a report containing many sub_reports grouped by Dealer/Distributor Number. The query I linked to the function is the query I use on the main report to get the information about each dealership.
View Replies
ADVERTISEMENT
Jan 17, 2007
Hi,
My situation:
A front end written in Access (back end mySQL).
I have made a .mde file out of this front end.
There are a number of MS Word documents used (as merge documents) for running reports and letters that are linked to queries in the database. However, I can only link these documents to the original .MDB file as you can't link to the queries ni the .mde file.
This works fine until you have a query that requires a parameter from a form. The user will have selected the parameter from the .mde version of the front end that they are using but the query which is being called from the .mdb version (by the Word merge document) can't see this parameter because it is a totally separate database.
How can I get around this problem?
Sorry this is a lengthy post, hope it makes sense.
Matt.
View 4 Replies
View Related
Mar 28, 2014
I've been trying to search for all picture files in my documents and copy them to a folder on the desktop. I found this and it work great for searching however I'm having trouble getting the copy to work. [URL] ....
Code:
Dim colFiles As New Collection
RecursiveDir colFiles, "C:Photos", "*.jpg", True
Dim vFile As Variant
For Each vFile In colFiles
Debug.Print vFile
Next vFile
Code:
I replaced the debug.print vfile with my copy function. I've tried copyfile but it needs to specify the destination with the file name. I tried using the FSO filecopy method and can't get it to work (keep getting a compile error "Expected =") I feel the hard part is done and this part should be simple.
View 3 Replies
View Related
May 10, 2007
Hello,
Does anyone knows how can I export the export/import specifications (which file/directory) and how can I import/export the specifications between different versions of Access. Thanks!
View 3 Replies
View Related
Mar 10, 2008
Hello All,
I am trying to export a query to multiple .csv files.. For example...
Export1.csv = rows 1-1500
Export2.csv = rows 1501-3000
Export3.csv = rows 3001-4500
and so on until all rows have been exported...
Anyone have any idea what the best way to approach this is?
I'm sure many people will find this usefull because some exports can be over the 65000 limit of ms excel.
View 4 Replies
View Related
Jul 23, 2012
I have a table that has over 6000 rows with two columns. One a title and the other a memo column with transcripts from interviews (some being extremely long). I do research using content analysis and to do that on these interviews, I need each one saved in its own text file.
Specifically I need to export each transcript into its own text file and save that file using the title from the other column. So I would end up with over 6000 text files all being saved using the title from the corresponding row as the transcript. Is this even possible?
View 14 Replies
View Related
May 21, 2015
I have a basic access query (MACs Report Template) that I need to export into multiple excel files based on the 1st field (Plan ID).
Example:
PLAN ID
Number
Amount
Status
AM141
12345
100
Disconnected
AM141
54321
5000
Active
AM142
11122
2000
Disconnected
AM155
22334
500
Disconnected
I need this to create a spreadsheet for each unique PLAN ID. Ideally i want it to export the following:
MACs Report AM141 20150521.xls (both records above should be in this report)
MACs Report AM142 20150521.xls
MACs Report AM155 20150521.xls
View 3 Replies
View Related
Dec 14, 2007
I'm wondering how other members here make decisions whether they want to place codes behind form or use a standard module instead.
I understand there is a performance penalty when you add another module (and use it), but am not sure whether one big fat module would be faster than several smaller modules with identical coding.
Furthermore, I know that some members use a hidden form to deal with startup and shutdown processing. Sometimes the processing has nothing to do with forms and would make more sense in a standard module, but since the form is already loaded, does it makes more sense to use the module behind the form than calling a function in a separate standard module to execute the needed code?
So, what do you tend to do in such situation?
View 14 Replies
View Related
Oct 1, 2004
I am creating an form in a database and whenever one of my procedure's run it creates this error message:
The expression ON Load you entered as the event property setting produced the following error:
Member already exists in an object module from which this object module derives.
*The expression may not result in the name of a macro, the name of a user-defined function, or [event Procedure].
*There may have been an error evaluating the function, event, or macro.
An ideas?
View 7 Replies
View Related
Nov 11, 2013
I have to write a code for my database,i have folder with files "pending Review" and a table with column "tblExcelLocation". when i run my database all the files from pending review folder goes to "tblExcelLocation" on a click of button.But,if the files already exists it should not insert those files and insert the rest.For this i tried to write a code but i think i m unable to do that .
Code:
Loop through files in folder
folderspec = "O:QA FilesQC ReportingPending Review"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.files
[code]...
View 7 Replies
View Related
May 2, 2012
Every hour a zip file is created in an FTP folder. The zip file contains an .mdb access database file with any changes to the data since the last hours file.
What is the best method to get access to connect to the content of the zip files and pick up the changes to the data?
View 3 Replies
View Related
Jun 7, 2007
Please advise how to attach documents within a database. I have Office XP (2002).
View 1 Replies
View Related
Apr 13, 2007
I need to be able to scan documents into individual records in access and I was wondering if this could be done.
View 2 Replies
View Related
Sep 19, 2007
Is there anyway to scan documents and save them in an Access table? As of now we scan them and save them to a folder on the network. Then go into Access form to add them into the tables. Would like to automate this process all from Access but have know idea how to go about this. Any suggestions?
View 4 Replies
View Related
Jun 9, 2006
Hi all,
Sorry but I'm really new to Access and trying to make sense of all the useful advice on here!
I'm trying to programme a button in one of my forms to open up a word document as read-only. I've written the code to open up the Word application (before I found the button which did it for me! :( ) but I think I need to add one or two more lines so that word knows where the document is I want and opens it up - any ideas what these lines are?
Real sorry for the trouble - any help would be most appreciated! Thanks guys and girls.
View 4 Replies
View Related
May 11, 2012
I'm new to Access and I'm trying to figure out how to use Access to populate documents. I assume I would create a form asking for information, and then Access would populate document(s) using the information.
For example, I need this information plugged into multiple Word Documents (or I guess I could combine all the word documents into a single PDF)
Name: John Smith
Project Number: 12345
Duration: 120 Days
Summary: This work would include...
...etc.
And then the program would use the information from the form to fill in an already created template, sometime using the same piece of information more than once:
_____________________ has a project number of _________________________. _________________________ has a duration of _______________________. The duration of ____________________ includes days associated with project number ____________________. The summary is __________________________________________________ _____________.
The template may go on for hundreds of pages, but the information from the form would still be used throughout most of the pages.
View 1 Replies
View Related
Jul 18, 2006
Is it possible to scan documents directly in to MS Access and store them in a field in a table please??
If so how??
Thanks for your help
View 2 Replies
View Related
Oct 21, 2006
I have a simple database for my rv rental business, I want to be able to import an existing form into access and then use the data in my dbase to fill in the forms to print and have the customer sign the contract etc. I use 2003 how would I go about doing this?
thanks
Jim
View 1 Replies
View Related
Feb 27, 2008
As a basic user and relatively new user of Access, I have designed a database which holds the data for several word documents that I use for mailmerges. I want to be able from the "switchboard" link the word documents so that users can easily access the letter/form required and print them. Ive tried many things - just not working!!!! Time to shout for help!
View 1 Replies
View Related
Feb 18, 2006
Hi all..
I am new to Access and currently implementing a small company database.
Is it possible to link Access to Word documents?
I wish to create a button on a form that when clicked it opens the word document according to what have been selected in the combo box in the form.
thanks :o
View 8 Replies
View Related
Oct 17, 2012
Because of certain design considerations and the amount of data I'm maintaining, I have chosen to use tabbed documents rather than floating windows or subforms.
The hierarchy is supposed to be a person who is categorized as either a client, family member, donor, etc. Further, a client may use one or more services. In the example, our client uses Specialized Home Care. However, the tabs are intuitively out of order: the people tab is left-most, followed by the Specilaized Home Care tab, and lastly the Client tab. It should be People, People:Client, People:Client:Service. If a person uses a lot of our services, there will be separate People:Client:Service tabs and the People:Client tab will scroll off to the right. I'd like Access to order them properly but see no way to do it.when the forms are opened, it's people first followed by the high-level classification (i.e. Client), and the lastly the specific Client:Service tabs. I would expect Access to open and display them left to right, but, as you can see, it doesn't.
View 7 Replies
View Related
Jan 25, 2008
I was wondering if there is an awesome way out there somewhere to take a record and export it into a word document, like a template and have the fields go where you want them to?
View 13 Replies
View Related
May 25, 2015
Customizing the form with the following code
Code:
Public Declare Function LoadImage Lib "user32" _
Alias "LoadImageA" _
(ByVal hInst As Long, _
ByVal lpsz As String, _
ByVal un1 As Long, _
ByVal n1 As Long, _
ByVal n2 As Long, _
ByVal un2 As Long) _
As Long
[code]...
I can load the little icon on the left on CaptionBar.It works very well on overlapping mode but no on Tabbed documents. How to works with tabbed documents mode?
View 9 Replies
View Related
Jul 18, 2012
I'm trying to use this API in my database to be able to attach documents to my forms. [URL] .....
Do I have to put this into its own Module? I'm not familiar with how the code is defining Types and declaring Global variables.
View 5 Replies
View Related
Jan 14, 2015
I am working on a project in which we have to print word documents of each policy so if the policystatus is "Live" then we have to print a document with header(barcode) on it. If the policystatus is "Cancelled" then print off a different sheet. The following code is written that works fine but the only thing is the print order is not right. documents jump up the queue. The documents spooled last get printed off first sometimes. Any other alternator to write the following code so that sheets prints off in order:
Code:
Public LivePol As Variant
Public CancelPol As Variant
Sub GetDataFromDataBase()
LivePol = 0
CancelPol = 0
Dim myDataBase As Database
[code]....
If we can write the code in a way so that printing sheets come up in the order.
View 1 Replies
View Related
Jun 4, 2014
I have a button that when pressed it checks a specific file for documents with the same name (example: Test, Test 1, Test 180, ect...)
Code:
Dim StrFile As String
StrFile = Dir("C:UsersJohnDesktopTest*test*")
Do While Len(StrFile) > 0
Debug.Print StrFile
MsgBox StrFile
StrFile = Dir
Loop
The problem with this is if there are 2 files with Test (Test, Test - Copy) It gives me 2 separate message boxes. The first with Test. Then a second message box with the second file, Test - Copy. I want to combine both of the message boxes in to one. So the message box would look like:
Test
Test - Copy
View 1 Replies
View Related