473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

report print out is different from preview mode - please help.

Hello,
I'm hoping someone can shed some light on why my report does not output
the same results as shown in preview mode, which is to move the
position of a check box based on a field value (see code below). The
code does exactly what I want only in preview mode; it moves the check
box only when the drug criteria is true. However, when I print the
report the check box position remains unchanged.

I tried putting the same code to both the Print and Format events but I
get error message 2101, the setting you entered isn't valid for this
property and highlights the line "intTop = 0.0208. I tried to
troubleshoot the setting but I'm not getting anywhere. I can't figure
out why Access only lets me preview the results and not print them.

I promised my boss this was doable but I'm not sure what I'm doing
wrong. If anyone could give me any help/comments I would truly
appreciate it.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim check As CheckBox
Dim intTop As Integer

Set check = Me.ChkBox202

If Nz([Drug].Value) = "Acetaminophen" Then

intTop = 0.0208

With check
.Top = intTop
End With

End If

Jan 27 '06 #1
4 2803
On 27 Jan 2006 15:32:31 -0800, Gary wrote:
Hello,
I'm hoping someone can shed some light on why my report does not output
the same results as shown in preview mode, which is to move the
position of a check box based on a field value (see code below). The
code does exactly what I want only in preview mode; it moves the check
box only when the drug criteria is true. However, when I print the
report the check box position remains unchanged.

I tried putting the same code to both the Print and Format events but I
get error message 2101, the setting you entered isn't valid for this
property and highlights the line "intTop = 0.0208. I tried to
troubleshoot the setting but I'm not getting anywhere. I can't figure
out why Access only lets me preview the results and not print them.

I promised my boss this was doable but I'm not sure what I'm doing
wrong. If anyone could give me any help/comments I would truly
appreciate it.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim check As CheckBox
Dim intTop As Integer

Set check = Me.ChkBox202

If Nz([Drug].Value) = "Acetaminophen" Then

intTop = 0.0208

With check
.Top = intTop
End With

End If


1) All measurements in Access are measured in Twips, 1440 per inch.
If your Top is just 0.0208 (Twips) you cannot see any movement.

2) Once you move it, nowhere in your code do you move it back if the
[Drug] value is not "Aceteminophen".
Your Preview code moved it, but then it was not re-set.

3) You have gone some hoops of coding to do a rather simple thing.

4) I assume ChkBox202 is the name of the check box on the report
detail section you wish to move.

Try it this way in the Detail Format event:

If [Drug] = "Acetaminophen" Then
ChkBox202.Top = 0.0208 * 1440
Else
ChkBox202.Top = ? * 1440
End if

Replace the ? with the measurement (in inches) that you want the Top
to be if the [Drug] value is not "Acetaminophen" .
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jan 28 '06 #2
Gary wrote:
Hello,
I'm hoping someone can shed some light on why my report does not output
the same results as shown in preview mode, which is to move the
position of a check box based on a field value (see code below). The
code does exactly what I want only in preview mode; it moves the check
box only when the drug criteria is true. However, when I print the
report the check box position remains unchanged.

I tried putting the same code to both the Print and Format events but I
get error message 2101, the setting you entered isn't valid for this
property and highlights the line "intTop = 0.0208. I tried to
troubleshoot the setting but I'm not getting anywhere. I can't figure
out why Access only lets me preview the results and not print them.

I promised my boss this was doable but I'm not sure what I'm doing
wrong. If anyone could give me any help/comments I would truly
appreciate it.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim check As CheckBox
Dim intTop As Integer

Set check = Me.ChkBox202

If Nz([Drug].Value) = "Acetaminophen" Then

intTop = 0.0208

With check
.Top = intTop
End With

End If

Just curious...what happens if you enter
If Nz([Drug].Value) = "Acetaminophen" Then
Me.ChkBox202.Top = 0.0208
Endif

One other thing. Run this code
Sub adsfasdfa()
Dim intTop As Integer
intTop = 0.0208
MsgBox intTop
End Sub

intTop in the msgbox is 0. However, if I change intTop to type Double I
get 0.0208.
Jan 28 '06 #3
Thank you!!! Thank You!! To both "Fredg" & "salad" for your great
feedback.

Fredg, you're right about everything you stated but handling the
checkbox position when the drug value was not "acetaminophen" was key
and in addition "salad's" suggestion; changing the intTop to Double
made
the whole thing come together. Finally----it WORKS!!! :>

This is the code I used:

Dim Check As CheckBox
Dim intTop As Double
Dim intTop2 As Double

Set Check = Me.Check202

If Nz([TradeDrug].Value) = "Acetaminophen" Then

intTop = 0.0208 * 1440

Me.Order_Format.Top = intTop
With Check2
.Top = intTop
End With

Else
intTop2 = 0.0988 * 1440

With Check2
.Top = intTop2
End With

End If

Feb 6 '06 #4
Gary wrote:
Thank you!!! Thank You!! To both "Fredg" & "salad" for your great
feedback.

Fredg, you're right about everything you stated but handling the
checkbox position when the drug value was not "acetaminophen" was key
and in addition "salad's" suggestion; changing the intTop to Double
made
the whole thing come together. Finally----it WORKS!!! :>

This is the code I used:

Dim Check As CheckBox
Dim intTop As Double
Dim intTop2 As Double

Set Check = Me.Check202

If Nz([TradeDrug].Value) = "Acetaminophen" Then

intTop = 0.0208 * 1440

Me.Order_Format.Top = intTop
With Check2
.Top = intTop
End With

Else
intTop2 = 0.0988 * 1440

With Check2
.Top = intTop2
End With

End If


Somehow my newsreader dropped my to this message when it opened...I
rarely look at old messages. Anyway...Great news on your part!!!!

What I've done sometimes is I'll move a control to a position. Let's
say I want Left and Top and Width.

I'll input in the GotFocus event
msgbox "Left " & Me.TextField.Left & vbNewLine & _
msgbox "Top " & Me.TextField.Top & vbNewLine & _
msgbox "Width " & Me.TextField.Width

Now I write the results of the messagebox down somewhere. Then I move
the control somewhere else. Run the same process. Now I know the
values I want to assign depending on a particular action.
Feb 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Wolfgang | last post by:
Hi, I need to timestamp printed records with the printing date. According to the customer's requests the report must be opened in preview-mode and the user clicks on the printer button if he...
5
by: nick_faye | last post by:
Hi, I am still a newbie to VB and using MS Access 2000. I am currently trying to provide a preview of reports before printing them. My program is simple: AC.DoCmd.OpenReport "MyReport",...
1
by: vermutmb | last post by:
I'm totally stuck. When I click on the "Preview" button for a report on the database window, pressing the <ESCAPEkey simply closes the report. But when I use DoCmd.OpenReport with acPreview on a...
7
by: itm | last post by:
I have a mail out to send to a group of owners with multiple accounts. I want to limit the number of accounts that print on the first page to 20. I want remaining accounts to print on a second...
7
by: TC | last post by:
I've produced an Access application for a client. For one report, text gets cut-off at the right margin when we print the report. It does this only when we print; it doesn't happen when we view the...
15
by: sara | last post by:
I am stuck. I have a report that I use in multiple places, so I call it with varying parameters (using the Where Clause in the code). I preview the report, send it to snap, then close the...
4
by: ramaswamynanda | last post by:
Hello, I have an application in Access where I have developed about 10 reports. These have been working for a while and produce data properly. I recently tried exporting the report, from the...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
4
by: scubasteve | last post by:
I've developed a product pricing application for a client in AC2007. They enter all the data on the one main form, then click a button to open a printable report in Print Preview. My problem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.