 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 7th, 2006, 03:50 PM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by echovue
So the field is showing NULL, or is it completely blank?
Mike
EchoVue.com
|
It's showing Null. I replaced the "" with "N/A" to test that and the "N/A" shows up.
|
|

September 7th, 2006, 03:54 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Sorry - I'm a little slow today...
Basically how the expression works is...
IIF(Condition, Value is True, Value if False)
So if the field is null, you should not have anything displayed.
If the field isn't null, then it should display the value in the field.
It sounds like the if it is null part is working. What appears when there is actually a value in the field?
Mike
EchoVue.com
|
|

September 8th, 2006, 07:12 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Sorry for jumping in, but you can put two bound textboxes where you want them to show up as lables, and then format them both to can shrink = yes. Alternatively, you can check them liek this:
If IsNull(Me.TextBox1) Or Me.TextBox1 = "" Then
Me.Textbox1.Visible = True
Me.TextBox2.Visible = False
Else
Me.Textbox1.Visible = False
Me.TextBox2.Visible = True
End If
Hey, I never said I was elegant.
mmcdonal
|
|

September 8th, 2006, 07:13 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Sorry again, I got it backeards:
If IsNull(Me.TextBox1) Or Me.TextBox1 = "" Then
Me.Textbox1.Visible = False
Me.TextBox2.Visible = True
Else
Me.Textbox1.Visible = True
Me.TextBox2.Visible = False
End If
mmcdonal
|
|

September 8th, 2006, 07:14 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
I am fat fingering everything this morning. More coffee is needed...
mmcdonal
|
|

September 8th, 2006, 09:45 AM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Where do I put that code? Right-click in the section of the report where the Textboxes are and do a 'Build Event'?
What is the 'Me.'? Do I need to change that to the name of the report or something?
Thanks again!
|
|

September 8th, 2006, 10:20 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Go to the Form's Properties dialog box, select the Events tab, then select the On Open event. Select Code, then put the code there.
Me refers to the form or report that the code is on and is a relative reference.
Access database objects have absolute references in this format:
For example, if you have a control called txtMyTextBox on a report called rptMyReport, you can refer to it in code like this using the absolute reference:
[Reports]![rptMyReport].[txtMyTextBox]
This is also called Bang Dot notation.
If you want to refer to the same control with code in an event on rptMyReport, you can eliminate the object and item reference and use:
Me.txtMyTextBox
If you use the absolute reference as above, you must make sure the item is open, or Access will tell you it doesn't exist. So if you want to refer to a combo box on a form from a query (common) you can only use the query when the form is open, or Access will tell you the form doesn't exist and won't let you open the query (or it will return no results).
Does this help?
mmcdonal
|
|

September 8th, 2006, 10:33 AM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, it's showing that both textboxes are null. I gotta be missing something obvious here...
|
|

September 8th, 2006, 10:37 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
When you say "it" is showing both text boxes null, what does that mean?
Is there a case where both text boxes would be empty? If so, create a label, and then put it on top of the other two text boxes and add code to the report to make it appear if both text boxes are null or empty.
mmcdonal
|
|

September 8th, 2006, 10:39 AM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Now I'm gettin this when running it...
'You entered an expression that has no value'
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Editing Datagrid |
toddw607 |
ASP.NET 2.0 Basics |
5 |
April 26th, 2007 03:06 PM |
| Need Help A Editing String! |
Little Shell |
VB.NET 2002/2003 Basics |
2 |
June 4th, 2005 03:05 AM |
| TextBox Editing |
chriskhan2000 |
BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 |
0 |
October 19th, 2004 09:38 AM |
| cell editing |
saiyedriyaz |
BOOK: Beginning Java 2 |
1 |
May 15th, 2004 04:27 AM |
| HELP!!! Datalist Editing |
cjcd |
ASP.NET 1.0 and 1.1 Basics |
1 |
April 3rd, 2004 08:17 PM |
|
 |