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

calculated field visible = false?

I have a calculated control "ContactInfo" on my form ... ="Attn: " &
[Contact]

In the OnCurrent event for the form I have the following code...
If Me.Contact Is Null Then
Me.ContactInfo.Visible = False
End If

The idea is, that if there is no contact listed (I have the contact field on
the form with visible property set to no) then this line will not display.
When I run the form I get error 'Runtime Error 424' Object required. What
gives.


Oct 1 '06 #1
4 2651
Try: If Len(Me.Contact & "") = 0 Then
Which handles Nulls AND ZeroLengthStrings

Is Null works in queries. You would have to use IsNull(Me.Contact) in your
context.

Jimmy Stewart wrote:
>I have a calculated control "ContactInfo" on my form ... ="Attn: " &
[Contact]

In the OnCurrent event for the form I have the following code...
If Me.Contact Is Null Then
Me.ContactInfo.Visible = False
End If

The idea is, that if there is no contact listed (I have the contact field on
the form with visible property set to no) then this line will not display.
When I run the form I get error 'Runtime Error 424' Object required. What
gives.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 1 '06 #2
Perfect, thanks.

"ruralguy via AccessMonster.com" <u12102@uwewrote in message
news:671da7e78c3d8@uwe...
Try: If Len(Me.Contact & "") = 0 Then
Which handles Nulls AND ZeroLengthStrings

Is Null works in queries. You would have to use IsNull(Me.Contact) in
your
context.

Jimmy Stewart wrote:
>>I have a calculated control "ContactInfo" on my form ... ="Attn: " &
[Contact]

In the OnCurrent event for the form I have the following code...
If Me.Contact Is Null Then
Me.ContactInfo.Visible = False
End If

The idea is, that if there is no contact listed (I have the contact field
on
the form with visible property set to no) then this line will not display.
When I run the form I get error 'Runtime Error 424' Object required. What
gives.

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 1 '06 #3
You're very welcome.

Jimmy Stewart wrote:
>Perfect, thanks.
>Try: If Len(Me.Contact & "") = 0 Then
Which handles Nulls AND ZeroLengthStrings
[quoted text clipped - 16 lines]
>>>When I run the form I get error 'Runtime Error 424' Object required. What
gives.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 1 '06 #4
Jimmy Stewart wrote:
I have a calculated control "ContactInfo" on my form ... ="Attn: " &
[Contact]

In the OnCurrent event for the form I have the following code...
If Me.Contact Is Null Then
Me.ContactInfo.Visible = False
End If

The idea is, that if there is no contact listed (I have the contact
field on the form with visible property set to no) then this line
will not display. When I run the form I get error 'Runtime Error 424'
Object required. What gives.
"Is Null" is valid in SQL, but not in VBA code. In VBA code you need to use
the IsNull() function. You also have no way to make the control visible again
once it is made invisible.

If IsNull(Me.Contact) Then
Me.ContactInfo.Visible = False
Else
Me.ContactInfo.Visible = True
End If

Since IsNull() returns a True/False the above can be shortened to...

Me.ContactInfo.Visible = Not IsNull(Me.Contact)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Oct 1 '06 #5

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

Similar topics

1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
2
by: K B | last post by:
Hi, Is there ANY WAY to hide a row/field in a DetailsView based on meeting a condition at the ItemCreated or ModeChanging event -- or any other way? There appears not to be, but I was hoping for...
2
by: markm75c | last post by:
Does anyone know of a way to sort a column which isnt databound or an actual field in the database, but is derived from a method? IE. I have a grid showing stats for softball, with a calculated...
2
by: aharding | last post by:
I have fields that are set to be visible or not visible based on the value of another field. These results are displayed in a continuous subform. It works fine except that it only displays the...
9
by: Haas C | last post by:
Hi all! Is there anyway I can override a value in a calculated field on a form? For example: I have a form which displays the following fields based on a query: Premium Due field has the...
7
by: turtle | last post by:
I want to find out the max value of a field on a report if the field is not hidden. I have formatting on the report and if the field doesn't meet a certain criteria then it is hidden. I want to...
2
Cintury
by: Cintury | last post by:
Hello, I saw a similar thread on this subject but did not find the answer I was looking for. I have a report that is used to find undistributed balances of food using a table and a subreport. It...
11
by: JJ297 | last post by:
I want to hide the Pin field below in my repeater. How do I do this? <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <tr> <td><font...
6
by: ManningFan | last post by:
Got a little problem here... I have a combo box (Combo5) which needs to make a different field visible depending on the choice made. Standard code for what I'm doing is as such: If...
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
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,...
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
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
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...
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.