By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,484 Members | 1,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,484 IT Pros & Developers. It's quick & easy.

Display an * on a button if the field is not empty

P: 28
I have a button on a form that pops up to show info in a field for a specific record. The text on the button is labled "Awards." I want it to also show an asterick... *Awards....if and only if there is data in the field, in others words not NULL. and someone would no that there is data in the field before clicking on the button.
Jan 29 '08 #1
Share this Question
Share on Google+
10 Replies


MindBender77
100+
P: 234
I have a button on a form that pops up to show info in a field for a specific record. The text on the button is labled "Awards." I want it to also show an asterick... *Awards....if and only if there is data in the field, in others words not NULL. and someone would no that there is data in the field before clicking on the button.
You could try:
Expand|Select|Wrap|Line Numbers
  1. If isnull(Textbox1.Value) = True then
  2. CommandButton1.Caption = "No Data"
  3. ElseIf isnull(TextBox1.Value =  False then
  4. CommandButton1.Caption = "*Data Present"
  5. End If
  6.  
Hope this points you in the right direction,
JS
Jan 29 '08 #2

P: 28
You could try:
Expand|Select|Wrap|Line Numbers
  1. If isnull(Textbox1.Value) = True then
  2. CommandButton1.Caption = "No Data"
  3. ElseIf isnull(TextBox1.Value =  False then
  4. CommandButton1.Caption = "*Data Present"
  5. End If
  6.  
Hope this points you in the right direction,
JS
Thanks, I'll give that a try..
Jan 29 '08 #3

P: 28
Thanks, I'll give that a try..
The button I am using is on a subform. So onClick it will open to display the data in the field of the subform, which is where I want to check. Should I try this code in the main form's OnLoad?
Jan 29 '08 #4

MindBender77
100+
P: 234
The button I am using is on a subform. So onClick it will open to display the data in the field of the subform, which is where I want to check. Should I try this code in the main form's OnLoad?
You can add an invisible textbox to your subform and use DLookup to search for the existance of records on the table your querying.

And Yes, you would use it on OnLoad of the Main form.

If you run into problem I can explain it further,
JS
Jan 29 '08 #5

P: 28
You can add an invisible textbox to your subform and use DLookup to search for the existance of records on the table your querying.

And Yes, you would use it on OnLoad of the Main form.

If you run into problem I can explain it further,
JS
Thanks..I'll give that a shot.
Jan 29 '08 #6

P: 28
Thanks..I'll give that a shot.
I am having difficulty with this expression in the invisible field on the form.
Expand|Select|Wrap|Line Numbers
  1. =DLookUp([Additional Title Notes]!additional_notes,"Additional Title Notes",[title_id]=Me![New Book Fact Sheet]!title_id)
Jan 29 '08 #7

MindBender77
100+
P: 234
I am having difficulty with this expression in the invisible field on the form.
Expand|Select|Wrap|Line Numbers
  1. =DLookUp([Additional Title Notes]!additional_notes,"Additional Title Notes",[title_id]=Me![New Book Fact Sheet]!title_id)
Here's the format for DLookup you'll need:

=Dlookup("[FieldName]","TableName")

I believe this is all you'll need but, for notation sake, here is the whole formate for DLookup:
=Dlookup("[FieldName]","TableName","[FieldName] = Textbox")

Hope this Helps,
JS
Jan 29 '08 #8

P: 28
Here's the format for DLookup you'll need:

=Dlookup("[FieldName]","TableName")

I believe this is all you'll need but, for notation sake, here is the whole formate for DLookup:
=Dlookup("[FieldName]","TableName","[FieldName] = Textbox")

Hope this Helps,
JS
I need a criteria where the id in one table = is in the other, table correct?
Jan 29 '08 #9

Expert 100+
P: 446

I believe this is all you'll need but, for notation sake, here is the whole formate for DLookup:
=Dlookup("[FieldName]","TableName","[FieldName] = Textbox")
Hi Guys
If you are equating a criteria to a text box rather than just a numeric value you need to concatonate with an ampersand, thus the syntax should be changed to;-

=Dlookup("[FieldName]","TableName","[FieldName] =" & Me!Textbox)
or however you reference your text box.

In this particular case the syntax may be;-
Expand|Select|Wrap|Line Numbers
  1.  =DLookUp("[additional_notes]","Additional Title Notes","[title_id]=" & Me![New Book Fact Sheet].Form!title_id)[/font]
  2.  
assuming the field [title_id] is on a subform called [New Book Fact Sheet]

I hope this helps

S7
Jan 29 '08 #10

P: 28
Hi Guys
If you are equating a criteria to a text box rather than just a numeric value you need to concatonate with an ampersand, thus the syntax should be changed to;-

=Dlookup("[FieldName]","TableName","[FieldName] =" & Me!Textbox)
or however you reference your text box.

In this particular case the syntax may be;-
Expand|Select|Wrap|Line Numbers
  1.  =DLookUp("[additional_notes]","Additional Title Notes","[title_id]=" & Me![New Book Fact Sheet].Form!title_id)[/font]
  2.  
assuming the field [title_id] is on a subform called [New Book Fact Sheet]

I hope this helps

S7
Thanks, I get #Name? error in the text field on the NBFS that has this expression as the control source.

The [New Book Fact Sheet] is the main form.

Both forms have [title_id] as the field name.

When I am in a specific record of the NBFS form I want to lookup the additional_notes field for that title_id in the subform Additional Title Notes table/form and if it is not empty display something on the button or next to the button so you know before clicking the filed is not empty.

What do you mean by "however you reference your text box?" The title_id is the field name and the text box on the NBFS with the is just Text214.
Jan 29 '08 #11

Post your reply

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