Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

You entered an expression that has no value.

Status
Not open for further replies.

willda58

Technical User
Jul 21, 2002
3
US
Hi to the list. This is a first question for me and I am somewhat of a novice. I am developing an application to keep the transportation information for our local school district. This includes keeping track of who subs for who and what routes are run. I have a form that one field is populated using combo box whose values are Morning, Evening, and Both.
If a sub drives in the morning or evening, they collect $25 in pay. If they drive morning and evening routes they get $50. I wish co convert this information to currency for the monthly report. I have tried the following code in the on open proceedure, only to get the runtime error 2427,
you entered an expression that has no value.

Private Sub Report_Open(Cancel As Integer)
Dim stDocName as string
Dim StRan as string 'This is the field that contains Morning, etc'
Dim intRPay as Integer

stDocName = "rptSub_Pay"
stRan = Me!Ran

If stRan = "Both" Then
intRPay = "50"
ElseIf stRan = " " Then
IntRPay = "0"
Else IntRPay = "25"
End If:
End Sub

When I try to open the report I get the above error. When I try to debug the VBE highlights the line.. stRan = Me!Ran.

Can anyone shed a little light my way?
TIA
Dan Will
 
The code is in the Report, right?

Then you need to remove "stRan = Me!Ran" and replace it with

stRan = Forms!YourFormName!Ran

You have to reference the form. The "Me" object references the object it is attached to, in this case the report. Kyle

[pacman]
 
Yes the code is in the open event of the report. I am not running the report from a form though. I am confused what the form that the info is input from has to do with the report?
Dan
 
Dan,

The info of when they drove is one the form, and then later you run your report right?

OK, I just misunderstood, I thought you were running the report from the form.

So, Dan, is this data all in the Detail Section?

Try putting your code, just as it is on the Detail_Print() event. Kyle

[pacman]
 
Kyle,
Thank you very much. I no longer get the "2427" error. I do get an invalid use of null error. (but I think I can work my way through that). I (dumb as it sounds) didn't realise that the different sections of a report had the ability to run code on different events.
Anyway....Thanks a bunch.
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top