How to make a Data Report in VB formated like an Access Label Wizard? RESOLVED
Could someone tell me how to get the Data Report to format the output like labels in two columns?
In Access there are label wizards that do this for me, but I'm using VB now and the way it is it fills the report page in only one column, and in the last label it chops the data into half in the first page and half in the second page.
Last edited by Zealot; Oct 24th, 2002 at 11:36 AM.
As far as I know it is very hard to get the VB data report to do exactly what you want. This is because it seems to be very limited. If there is any one out there that can prove me wrong please do as it would save me allot of work.
Your best option to save many a head ache, would be to create the report in Access and then call it from vb. You can either open the report in an Access Shell an then call the print function or you can output the report to a Snapshot Viewer file and add a Snapshot Active X control to a form with the path of the saved file.
Try looking up 'OutputTo' and 'OpenReport' in the Access help to get some more information.
Originally posted by sertev Your best option to save many a head ache, would be to create the report in Access and then call it from vb. You can either open the report in an Access Shell an then call the print function or you can output the report to a Snapshot Viewer file and add a Snapshot Active X control to a form with the path of the saved file.
Try looking up 'OutputTo' and 'OpenReport' in the Access help to get some more information.
Originally posted by ralph Custom built recordsets are the ace in the hole
Ralph I need more than that to understand you. You've been helping me a lot with the Data Reports, and I thank you for that. But still, it's not enough, for I'm stuck in this project; my first professional project (as you might have been suspicious already ) wich should be presented next week to the client!
For example, I would like to put in the labels "Mr." or "Mrs." before the name of the person by reading the gender field. The problem is that the rptTextBox must have a different datamember than the rest of the textboxes, but it seems that a Data Report's Controls only allows binding to 1 Data member!
How the heck will I get out of this one?
Not to mention the "tip" you gave in another thread about adding another column in the Data Report! I can't understand it! And I can't find any useful info beside you, ralph!
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase currentDir, False
objAccess.DoCmd.OutputTo 3, reportName, "Snapshot Format (*.snp)", "c:\somefile.snp", False
objAccess.Quit 2
Set objAccess = Nothing
This outputs the report to a Snapshot Viewer Format without actually making Access viewable to the user. When it finishes the output, it closes Access. All you have to do is add a Snapshot Active X to a form and set the path to the exported file.
This works great and the user does not even know that it has come straight from Access.
Zealot,
To include Mr/Mrs fields, the gender rptTextbox's datafield should be set to the gender, right? What does that have to do with the report's datamember?
As for the "extra column" stuff, I'll explain later, but perhaps the Access report way will work before then anyway?
To follow up about the gender field. It's true that each section of the report has only one datamember (though a report can have multiple sections).
I wasn't sure what you meant "rptTextbox must have a different datamember". Why must? Couldn't the Command (on which the datamember is based) include a select ... join to include the gender field in the commandText so that it is part of the same datamember? I'm guessing since I don't know how you've structured things, like is the gender field in a different table from the others?
Ralph, yes, I could use the same command IF you could light up my mind how to put that in SQL terms.
I'm at home right now, but I'll check on this more precisely tomorrow. But I think it's all about putting it in proper SQL actually. From what I've tried today I wasn't able to put an IIf() to work in the SQL.
I can have it on same table.
So what I initially tried (in an Access query - it's faster ) was:
SELECT Gender FROM Table Where IIF(Gender, "Dear Mr.", "Dear Mrs.")
It just gives me the field Gender without any change.
The computer is right of course. But there must be something narrowing my mind that's not allowing me to breakthrough.
There should already be a version of snapshot viewer on your computer. It comes packaged with Office (I think). If not you can go to this page and download it
After you have finished installing it. Start up your project in VB and then go to the 'Project' menu. Then click on 'Components'. This will bring up the components window. Scroll all the way down to the bottom untill you find 'Snapshot Viewer Control'. Tick the box and the click on 'OK'.
You are set to go. Add the control to you form. Then in the 'From Load Sub' add the following code:
A way to do it in vb (the explanation you wanted):
Here's an example to get a twin set of columns in a vb report with a custom rs. I modified the original demo I gave you. Assumes a copy of Nwind.mdb is in the C dir.
Run time error 2282
The formats that allow to export data as Microsoft Excel, format rich-text, text of the MSDOS or as files of HTML are not present in the register of the Windows. Execute the configuration program to reinstall the Microsoft Access or, if you are familiar to the definitions of the register, try to correct them manually. For more information on the Register, it makes click on ' Help '.
Babelfish translation! And tweaked by me!
Anyway here I go in the quest for the missing Office 97 CD...
Ralph, I'm going to try sertev's tip until I have no way of achieving it. But thank you for posting an example. It's great to have a plan B.
I just tried to see if there was anything left to install from the Office 97 CD. And there isn't! Only the Archive and Outlook aren't installed, so I really don't know what can I do to make it work!
Edit: And yes, I used the link you provided, since this pc didn't have the component. In fact, since we're speaking of components you didn't need to be so precise about the steps needed to add a component! Though this might be my first professional application, I've built some OCXs myself!
Did not mean to ruffle your feathers. I work on the fact that when you say something, give as much detail as possible.......saves having to ask a second question.
When does the error occur?
What happens if you change the output to lets say Excel?
It's that ass called Office 97!
I checked wich converters were installed and only the Excel and the HTML were. So from the several filters VB offers me to export, only with the Excel and the HTML I was successful!
So the question is:
Can someone with Office 2000 send me the files I need (and tell me how to add them to the registry)? Not an easy task ahead...
Of course, I could try to install Office 2000, but how will it work in the clients' computers?
Yes, the screenshots are working properly.
Unfortunatly they are a bit too slow...
I'm considering in putting some form with a label saying "Loading" or something.