make a null check simple??

zozew

Registered User.
Local time
Today, 18:30
Joined
Nov 18, 2010
Messages
199
Hi ya'll

Im making tons of word docs and merging tons of values up to 50 a time... How would i make a null check like this simpler and maybe into a function??

Code:
If IsNull(Me!WifeName) Then .Item("WifeName").Range.Text = "------" Else .Item("WifeName").Range.Text = Me!WifeName

If i dont do this check i get an error promt for any null value in a record when i do the merge....so i was hoping somehow i could make a function with the two parameters "name of the form textbox in access" and the "name of the bookmark" in word.

Then for each different word doc i I'd make a table with all the names for that particular merge. That would be nice and expandable if there where additional word docs added.....
 
From Access Developer Reference...
Application.Nz() Method.
You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. For example, you can use this function to convert a Null value to another value and prevent it from propagating through an expression.
For your purposes you can do ...
Code:
.Item("WifeName").Range.Text = Nz(Me.WifeName, "------")
 
Sweet that was an easy way of doing it :D

thx a million!
 

Users who are viewing this thread

Back
Top Bottom