473,320 Members | 2,097 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,320 software developers and data experts.

Report - VBA If Then...

Hi everyone.

I am working on a report that has a running sum text box throughout the detail section of the report. In the report footer I have a summary in which I have a text box i.e. txtTotal, which has the final total of the running sum box in it. I am setting the txtTotal box to store the Nz value of the running sum, so if it is null, then txtTotal is 0, therefore it will always have a numeric value.

In VBA on the report format section, I have an IF...Then statement in VBA saying:

If Me.txtTotal>0 and Me.txtTotal < Then
Me.txtexample="example"
End If

However, when I run the report, I keep getting an error saying 'Run time error 13 - Type mismatch' and it flags up the line:
If Me.txtTotal>0 and Me.txtTotal < Then

But when I hover my cursor over the txtTotal field it says 'txtTotal=0', so my question is why does it enter into this if statement for only when txtTotal is greater than zero, when it is even saying it is equal to zero when I put my cursor on it?

Thanks.
Gareth.
Apr 7 '08 #1
2 1942
Stewart Ross
2,545 Expert Mod 2GB
Hi Gareth. If what you have posted is what is in your code you are missing a value after the less than symbol:
If Me.txtTotal>0 and Me.txtTotal < Then
Me.txtexample="example"
End If
Placing an X where there should be a number or a variable to compare you should have:
Expand|Select|Wrap|Line Numbers
  1. If Me.txtTotal>0 and Me.txtTotal < X Then
  2.   Me.txtexample="example"
  3. End If
-Stewart
Apr 7 '08 #2
Thank you for your response.

I do apologise, it should say '< 7' i must have missed it lol.
Apr 7 '08 #3

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

Similar topics

4
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm,...
3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
0
by: Rahul Chatterjee | last post by:
Hello All I have designed a dotnet application using VB which basically takes a selection and passes value to a crystal report which in turn passes the value to a Stored procedure. After the...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
9
by: itmags | last post by:
I need to create a couple of reports, invoices, credit reports, etc... My question is: How/what is the best way to go about this using VB2005 / SQL Server 2000 Crystal Reports? MS Reporting?...
13
by: Greg | last post by:
Most suggestions on this topic recommend to use a page footer and make it visible only on the last page. My problem is that the footer is half of the height of a page which means the detail would...
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
0
by: kamboj.shalabh | last post by:
Hi to all, Well, I am working on dotnet 2005 with crystal reports 10 and backend as sql server. I am facing a problem while loading a report. Actually the issue is, when I load report it takes...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.