473,699 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postcard printing based on different options.

jinalpatel
68 New Member
Hello

I am a novice to Access/VBA and this is driving me nuts. Any help would be appreciated.

I have to create a little application which can print postcards(4"X6" ) based on following options:
Customer Type
OrderNumber
LoggedDate
Location

There are three cmd buttons Print, Preview and Cancel.

I created one report which has general look and feel of postcard(exmple return address on left hand upper corner and To address in the middle)

I developed four queries based on 4 different options.
qry_CustomerTyp eOption
qry_OrderNumber Option
qryLoggedDtOpti on
qryLocationOpti on

When I assign one query to report's recordsource it works fine

My problem:

I want to change the recordsource of the report to the different queries as per the options selected. I don't know how to do it. I tried with the

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPreview_Click()
  2. Select Case Me.Frame0.Value
  3.  
  4. Case 1
  5.  
  6. DoCmd.OpenReport "rptPostCard", acViewPreview, "qry_CustomerTypeOption"
  7.  
  8. Case 2
  9.  
  10. DoCmd.OpenReport "rptPostCard", acViewPreview, "qry_OrderNumberOption"
  11.  
  12. End Select
  13. End Sub
Please help.

thanks
Dec 9 '08
11 1880
NeoPa
32,569 Recognized Expert Moderator MVP
Jinal,

Nothing immediately springs to mind that would explain your problem.

Let me just highlight a few things first in your code, then I will ask you to trace (Debugging in VBA) through the Report_Open() code to see how much of it is being processed and which route it takes.
  1. Check out Require Variable Declaration.
  2. Similar to the last one, Always compile code before posting with a request for help. There is little more annoying to someone willing to offer some of their spare time than finding a problem that is easily resolved simply by using the compiler. I doubt this will find your particular problem now, but it is definitely worth everyone making a note of. Always worth pointing out.
  3. In your cmdPreview_Clic k() procedure you use a Select ... Case statement where each of the Case statements has the same code in it.
  4. Code indentation should never be random. There is information in where the code starts. It is not mandatory, but it can impart information to the reader. Conversely, the incorrect positioning can actual send misleading information and can make the code harder to read and understand. This is not generally appreciated.
  5. Expand|Select|Wrap|Line Numbers
    1. Select Case ctl.ControlType
    2. Case acTextBox
    3.     ctl.Value = Null
    4.     Case acComboBox
    5.     ctl.Value = Null
    6. End Select
    Can, more clearly be written as :
    Expand|Select|Wrap|Line Numbers
    1. Select Case ctl.ControlType
    2. Case acTextBox, acComboBox
    3.     ctl = Null
    4. End Select
The most important point with respect to your current issue would certainly be to look at the tracing of the code to determine where it is going that you do not expect it to go. The other points are well worth looking at though.

PS. Sorry for the delayed response. I've been mainly unavailable for a while and have struggled to keep up with all my ongoing threads. Hopefully we can get back to sorting this out now.
Dec 16 '08 #11
jinalpatel
68 New Member
Thanks NeoPa,

I figured out this problem.

my 2nd option was not working as I have made a silly typing mistake for typing name. In query I wrote txtEndOrderNo instead of txtEndOrdNo

my 3rd option was not working as I have made mistake in capturing the date values. I didn't write # in front and in the end of my date field.

my 4th option is little bit wierd as I had to add one table that tablle although does not contain any field of my interest but just the reference table. Anyhow by using F9 I figured it out. Today was project deadline and thank go I finished it on time.

Thanks very much for guiding me through all those problems.

I appreciate your help.


@NeoPa
Dec 16 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2223
by: Mark Preston | last post by:
Admission first - I don't actually have a problem here but have noticed that a lot of people have been asking similar questions and getting very varied answers. What I've done is to sort of "compile the questions" into a theoretical problem to see what people think should be done to solve it. Maybe it will be a worthwhile discussion, but more importantly maybe it will find out the very best way to sort this kind of problem out so that...
16
3934
by: J. B. Moreno | last post by:
I read the faq, and it mentions that IE 4 on windows requires setting a printing option to allow background colors to be printed. Things change, life goes on, other browsers come into existence.... So, is there a way in CSS to say "Yeah, print these background colors", without the user having to turn on an option that will then apply to all pages printed? Thanks,
0
1182
by: wijaja_anton001 | last post by:
Electronic postcard just like paper postcard www.myepostcard.com
5
3337
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath = "P:\2004worksheets\IIS_WS.doc" Set oWord = New Word.Application oWord.Documents.Add (strObjectPath) oWord.PrintOut
2
2888
by: Jurjen de Groot | last post by:
I'm about to start a new ASP.NET application, this application will generate several types of documents (PDF HTML XML-DOC) wich have to be printed at the client-side... (probably on different printers A3 and A4 type) At this time I'm trying to figure out what would be the best way to accomplish this : 1. printing through HTML in a IE windows will result in page title & nr as header and URL + Date as footer, wich is far from acceptable....
0
1382
by: Phil Galey | last post by:
I'm printing to a DeskJet 5550 printer. From WordPerfect, if I have a color document and I specify grayscale in the printer properties dialog, it prints in grayscale as expected. However, from a VB.NET application, I don't seem to be able to get it to print in black and white / grayscale. It always prints in color. I have a 3rd party DLL called QuickPDF which works with PDF documents. It enables you to specify monochrome or color as...
1
5080
by: Dreamtime | last post by:
Hi I am using Visual Studio 2005 and the bundled Crystal Reports (previously I used .net 2003 and bundled Crystal Reports for 2 years - same issues!) I have a report which is displayed in the crystal reports viewer. This report needs to be printed. Its that simple! I would like to use the report.printtoprinter method as this is direct
0
1921
by: postcard.com | last post by:
</div> <strong>Hello friend !</strong><br> You have just received a postcard from someone who cares about you!<br><br> <strong>This is a part of the message:</strong><br> &quot;Hy there! It has been a long time since I haven't heared about you!<br> I've just found out about this service from Claire, a friend of mine who also told me that...&quot;<br> <strong>If you'd like to see the rest of the message click <a href="http://sisu.ro">here</ato...
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.