473,748 Members | 4,178 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 1884
NeoPa
32,570 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
2225
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
3937
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
1183
by: wijaja_anton001 | last post by:
Electronic postcard just like paper postcard www.myepostcard.com
5
3350
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
2896
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
1387
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
5084
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
1923
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
8987
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
8826
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
9366
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
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
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();...
1
3303
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
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.