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

Auto Assign Variable text based on parameters

P: 83
I have a button that when pressed on a form, automatically reads statments and inputs a text sentence, based on other fields on the form. However, the variable only gets assigned a sentence if something is true, but null if it is not true. The below code sits after all of the criteria statements. The problem is that when the first four statements are null, the field has four spaces before the sentence. This is obvious because of the " " after ever variable. Is there an automatic function that only read a space if the previous variable is not null, or do I have to make an isnull statement for every " ".

Expand|Select|Wrap|Line Numbers
  1. Me.Pending_Reasons = NoLE & " " & updttfs & " " & updtavs & " " & Illno & " " & updtfas & " " & updtmidl & " " & updtisc & " " & SurNoLE & " " & surupdtfs & " " & surupdtmidl & " " & surupdtemsi & " " & surupdtavs & " " & surupdtfas & " " & surupdtisc
May 15 '07 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
You have posted this question in the articles section.

I am moving it to the Access forum.

ADMIN
May 15 '07 #2

NeoPa
Expert Mod 15k+
P: 31,342
I think you'll find that the IsNull() is required repeatedly :(
You could write your own VBA function to handle it though.
May 15 '07 #3

NeoPa
Expert Mod 15k+
P: 31,342
Please visit this thread to see why we would rather you didn't double-post (Please do Not Double Post ).

MODERATOR.

In this case you've wasted the time of a number of experts and also caused a mess that needs to be cleared away.
May 15 '07 #4

NeoPa
Expert Mod 15k+
P: 31,342
In the OTHER thread (Handling Nulls in a String), you will find a better answer than mine. Mine was wrong so please ignore it.
May 15 '07 #5

Post your reply

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