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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referencing a table in a report via MS Access

Status
Not open for further replies.

atray04

Programmer
Dec 29, 2003
112
US
heres my code:
Me refers to my report and walkways is a textbox

If Me.Controls!Walkways.Text > "2" Then
Me.Controls!Walkways.Visible = False
Me.Controls![Walkways Label].Visible = False
End If

I am trying to check to see if the value in my text box is bigger than 2, but since I have my text box referenced to my table it is not letting me do this (this is what I think). This code right now crashes access. So I think I need to change the first line so it points to the value in my table, but I can not seem to reference it correctly. Any help would be great. Thanxs
 
Have you tried this ?
If Me!Walkways.Value > "2" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tried that and I got the error no value. I think it is because there is no value, since I am using a query to get my data from my table.
 
Hi!

There is an Access Reports forum (forum703), se also some of the other Access fora in the related forums box at the right.

Here, I'm guessing it's because you refer to the .Text property of the control, in stead of the .Value property (default) of the control. Another thing, you are performing this in the on format event of the section where the "Walkways" controls reside? Try also dropping of the quotes around 2.

Also recomended to post the excact errormessage, which makes it a bit easier to assist;-)

Roy-Vidar
 
Gee - do I need to learn faster typing (and how to use the refresh button) :)

Roy-Vidar
 
I have tried no quotes as well. Ive tried pretty much everything that I can think of and ill move this over to the access forum, but I thought that this seemed more VBA related.
 
Here is the exact error message:
Run-time error '2427':
You entered an expression that has no value
I receive this message with this code:
If Me.Controls!Walkways.Value > 2 Then
or this code
If Me.Controls!Walkways.Value > "2" Then

and when i type:
If Me.Controls!Walkways.Text > 2 Then
with quotes as well, it crashes.

So how would I reference this to my table with my data?
 
myself said:
Another thing, you are performing this in the on format event of the section where the "Walkways" controls reside?

Which event are you using? I get that message if I attempt something like that in the reports on open event.

Roy-Vidar
 
Have you tried this ?
If Nz(Me!Walkways.Value) > "2" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
When I do that I still recieve the message that there is no value. I think my value is not there, I think that it is coming from the table and not the report since my control source is pointing to my table.
 
I'm not sure the table data is available (yet read) in the open event.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
hmmm, well any suggestions on how I could do this?
 
For the third time - use the on format event of the section where those controls reside (detail, some header...)

Roy-Vidar
 
ahh ok, I changed that but it seems to be changing the values for everything. That is one reason why I wanted to point it to my table of values.
 
Ok well I guess I will just tell you exactly what I am trying to do, because this is getting frusturating.

I have a list of values in a report that have been generated by querying my table now I want to modify this list so that only certain values appear and there should also be no spaces where the other values used to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top