Concatenating (2x unbound into bound)

justinwright

Registered User.
Local time
Today, 17:56
Joined
Jul 14, 2010
Messages
19
I've read similiar articles, and tried solutions on each, but for some reason none of it is working

I have three boxes

1) Explanation
2) chknum (check number)
3) ditm (date item)

It's usually either chknum or ditm, but it can be neither. I have an if statement changing the visibility of the boxes based on if it's needed or not.

Regardless, I want to concatenate the applicable item into a box that's bound to a table (it's interfacing with an older program, long story).

Sample code is as follows:

Code:
If Me.Explanation.Value = "VOID" Then
Me.Concatenated.Value = [chknum] & " " & [Explanation]
End If

Whenever I do that, it still returns just "VOID" in the box, nothing else

I've also tried:

Code:
If Me.Explanation.Value = "VOID" Then
Me.Concatenated.Value = Format([chknum], "00000000") & " " & [Explanation]
End If

Any help is much appreciated!
 
Try

Code:
If Me.Explanation.Value = "VOID" Then
Me.Concatenated.Value = Format(Me.chknum, "00000000") & " " & Me.Explanation
End If
 
Sorry for the double post, but I narrowed it down. I have an option for a custom reason, and if so I just wanted it to put that reason in the concatenated box. The code is as follows

Code:
If Me.Explanation.Value = Null Then
Me.Concatenated.Value = " "
Else
Me.Concatenated.Value = Me.Explanation.Value
End If

I had put that AFTER all of my other code, unlike putting it first like I should have. I figured I'd post this in case someone did something retarded like I just did, maybe it will help someone else too :).

Thanks anyways guys!
 
might want to try...

Code:
If IsNull([Explanation]) or Explanation = "" Then
     Concatenated = ""
Else
     Concatenated = Explanation
End If
 
Or even smarter would be:-

Code:
If Len(Nz(Me.Explanation,"")) = 0 Then
     Me.Concatenated = ""
Else
     Me.Concatenated = Me.Explanation
End If
 
It's working as it is. Is it a bad thing to write it like I did? Will it hurt anything?
 
You should change it because you are currently only checking for a null value and not an empty string, i.e. a user could start typing an explanation and then delete it and then it is no longer a null value in which case your concatenated field will be set to equal the same value
 
Oh that makes sense. Thank you very much, I'm a bit new at all of this :)
 
Well as long as you're willing to learn I'm sure you'll pick it up in no time!
 
Why would you have two separate reasons for issuing a check?:confused:
 
Haha... there are actually about 8 reasons that an operation would require a check number; it's a bit of a long story. Even so, it's not just for checks, it does a lot more involving charges, credits, etc for generating reports and interfacing with an old dBase III file. The code snippets are only a piece of what all it checks, but the syntax is so similar as makes no difference, making anything I got wrong on one relevant on the others.
 

Users who are viewing this thread

Back
Top Bottom