NZ question

gripper

Board Regular
Joined
Oct 29, 2002
Messages
176
I have a form "Transaction Detail" At the top in the form header I have a text box and in the properties under control source I have the following

=Nz([txtSubject_ Property],"Untitled")

I am trying to get the data in the txtSubject_Property box to show up at the top as a record label. I copied this from another DB and tried to adapt it. Currently the only thing that shows up is ?name. I doubled checked my naming and it is fine. My syntax is off somehow or perhaps there is another solution that is better.

It is not working I would love some advice for correcting it.

I want to also go one step futher and also add the data in the txtCity field as well.

So it should look like example "1234 Main Street, Sacramento" when the record is opened.

Thank you very much
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I would recommend using the NZ function in a calculation in a Query (instead of directly in the Form). Then use this Query as the source of your Form (and subsequent Text Boxes in the form).
 
Upvote 0
=Replace("txtbox |","|",Nz([txtbox]," (New)")) This is what I use, it displays what I have in the txtbox, and if its a new record it displays "New". The "txtbox" of course gets replaced with whatever field on the form you are trying to display.
 
Upvote 0
Xander,

How would I use two text boxes. This first on is the subject property (ie; 1234 Main street) then I want to add a comma (,) then a space and then add the info in the txtCity box (ie: Sacramento) So when all is done it will look like "1234 Main Street, Sacramento"

Thank you
 
Upvote 0
Once again, I would recommend doing the calculation in a query, i.e.
MyAddress: Nz([txtSubject_ Property],"Untitled") & ", " & [txtCity]
 
Upvote 0
Just to let you know that the likely problem when used in the text box directly is that if you have a formula of any type, NZ included, you MUST make sure that the text box is NOT named the same as the field. The default when using the wizard to create the report or form is that it names the controls the same name as the field and if the bound field is used then there is no problem. But, if you use anything that starts with an equals sign, then you must make sure to change the control name and not use it in the formula, but use the field instead (at least on a report).
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top