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

Text Box with data source of iif statement

I have a text box on a form with the following data source iif statement.
Expand|Select|Wrap|Line Numbers
  1. =IIf([leasecnt]=0,"No Leases Entered ",IIf([tbl_leasefllwup].[Form]![fllcnt]=0,"No Items Entered",IIf([tbl_leasefllwup].[Form]![pstd]>"0","Past due Follow-up Items",IIf([tbl_leasefllwup].[Form]![Due]>"0","Follow Up Items to Review","No Review Items"))))
  2.  
This text box is to display the proper text accordingly.

allI keep getting is #Name?
What am i doing wrong?
Please help
Oct 14 '08 #1
7 5101
NeoPa
32,556 Expert Mod 16PB
References must be to the underlying data source or form controls. Referring to specified table fields is not possible.

You give too little info to be much further help at this time.
Oct 14 '08 #2
References must be to the underlying data source or form controls. Referring to specified table fields is not possible.

You give too little info to be much further help at this time.
All of the controls in the if statement are form controls they are unbound cont fields
Oct 15 '08 #3
GazMathias
228 Expert 128KB
All of the controls in the if statement are form controls they are unbound cont fields
From what I can gather, you are just trying to write a bit of status text depending on some conditions. If this were me I would write a sub containing a few If and/or Select statements to check all of your conditions and have the form call that sub after it opens / changes. It would write its result to a Label on the form, not a textbox.

For three reasons really,

1, It is much easier to read code when it is indented and commented (not only to others but for yourself months/years later).

2, So that you can debug it in the VB window when you call it (by clicking in the margin next to the sub name, a burgundy dot will be placed there signifying that the next time you run it it will open the VB window and you can step through the code using F8, checking your logic and flow control. Also if you hover over a variable, it will show you its contents (after it has been parsed). You can also type commands directly into the Immediate Window as afurther tool.

3. Error Handling.

If all of the controls you are trying to check are on the form, reference them like

Expand|Select|Wrap|Line Numbers
  1. Dim somevariable As String
  2.  
  3. somevariable = Me.SomeControl.Value
  4.  
  5. If somevariable = "somestatus" then
  6.   Do something
  7.     Else
  8.   Do something else
  9. End If
Then update the label like

Expand|Select|Wrap|Line Numbers
  1. Me.LabelStatus.Value = somevalue
Gaz
Oct 15 '08 #4
NeoPa
32,556 Expert Mod 16PB
Good tips Gaz. An article on debugging can be found at Debugging in VBA. To display data in a label use the .Caption property rather than the (non-existent) .Value property. .Caption doesn't appear in the list of label properties you are prompted with, so you will need to type it out in full.

@OP I will look again in the light of what you've posted, but you obviously haven't put a lot of effort into providing helpful information, so I doubt I'll be in any better position to help when I do. Your choice.
Oct 16 '08 #5
NeoPa
32,556 Expert Mod 16PB
All of the controls in the if statement are form controls they are unbound cont fields
If [tbl_leasefllwup].[Form]![fllcnt] is a reference to a control on your form then it is an invalid one. This is at least one of your problems.

No idea what "cont fields" are :S
Oct 16 '08 #6
GazMathias
228 Expert 128KB
Caption property rather than the (non-existent) .Value property.
Oops, my bad. Thank the powers that be for Intellisense!
Oct 16 '08 #7
NeoPa
32,556 Expert Mod 16PB
We try Gaz ;)

We also make mistakes too of course so no worries :D
Oct 16 '08 #8

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

Similar topics

27
by: C Gillespie | last post by:
Dear All, Hopefully I have a simple problem. Basically, I just want to alter some text with JS. Here is some of my test code: <snip> <script type="text/javascript"> var tmp='a';
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
4
by: N. Graves | last post by:
Hello, Please help me I'm still a newbie. I have an unbound text box on a report that I would like to build a expression to display it on the report. Something like txtboxSearchCriteria = !!...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
1
by: svijay | last post by:
hi I have got a strange problem. May I know any solution for this. Here is the detailed description about the problem We have got a mainframe system and also production and development...
14
by: mfrsousa | last post by:
hi there, i have a huge large text file (350.000 lines) that i want to import to a MS Acccess Database, of course i don't want to use Access, but do it with C#. i already have tried the...
4
by: Swinky | last post by:
I am trying to make a combo box dependent on a text box. I cannot get the combo box to pull the related data from the text box. I have been all over this user group & have tried several versions...
7
ADezii
by: ADezii | last post by:
There are essentially three techniques for publishing Access Data on the Web. The first technique is static, and does not allow for the dynamic addition or modification to the data, There is no...
9
by: RICHARD BROMBERG | last post by:
Please bear in mind that I am a newbie. I am posting this question a second time because the responses to my earlier post were a little wide of the mark. So, here goes: I am using Access 2000...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.