IF Then Else.......I need the Else answer

  • Thread starter Thread starter Mike375
  • Start date Start date
M

Mike375

Guest
As you can you see the following is part of a code block for inserting into Word bookmark

DoCmd.OpenForm "ProspectNotes", acNormal, "", "[NameNumber]=[Forms]![PrintandClose]![NameNumber]", acEdit, acNormal

Set WordRange = wordDoc.Goto(What:=wdGoToBookmark, Name:="a5")

WordRange.InsertBefore [Forms]![ProspectNotes]![ActdateComments]

What can I do when [ActdateComments] is null.

My only solution at present is to have two different modules and run them with a macro RunCode action and with conditions based on [ActdateComments]. The problem with that solution is there is more than just one field involved so I would need a bundle of modules.
 
What do you mean with "What can I do when [ActdateComments] is null"? You can do anything you want! Do you mean you want to check if that value is null and if so, add a different value? The nz function does that for you. For example:
WordRange.InsertBefore nz([Forms]![ProspectNotes]![ActdateComments], "Not filled in")
Not sure if this is what you meant :p
 
The expression does not run if the field is null, debug gets inappropriate use of null.

If the field is null I just want the expression by passed and the relevant bookmark in Word left blank.
 
WordRange.InsertBefore nz([Forms]![ProspectNotes]![ActdateComments], "")
?
 

Users who are viewing this thread

Back
Top Bottom