Re: Global variable losing value for no apparent reason
- From: "bcap" <bcap@xxxxxxxxxxxxxx>
- Date: Mon, 28 Jul 2008 19:37:28 +0100
Sorry but you're wrong there. It's the "+" concatenation operator that
evaluates to Null if one of the operands is null. The "&" operator treats
the Null operand as a zero-length string.
"JvC" <johnvonc@xxxxxxxxxxxxx> wrote in message
news:DEkjk.4653$LF2.2171@xxxxxxxxxxxxxxx
So the code used to work, and it doesn't now. If you look at the code you
posted below, I think your line:
MyStrVar = MyStrVar & "*" & !QryID & "*"
could be the problem. If you somehow got a dreaded NULL in !QryID, this
entire loop will evaluate to NULL. Is the tblDatabaseQueries table being
reloaded at some point, that would cause this behavior?
Look at your table, and find the record where !QryID is Null and fix it.
Then redesign the table so it doesn't allow Nulls in that field. Also, if
the table is being reloaded at some point, make sure all of the records
are cleared.
Good luck!
John
It happens that teddysnips@xxxxxxxxxxx formulated :
Set rcd = CurrentDb.OpenRecordset("SELECT tblDatabaseQueries.QryID
FROM tblDatabaseQueries;")
If rcd.RecordCount > 0 Then
With rcd
.MoveFirst
Do
MyStrVar = MyStrVar & "*" & !QryID & "*"
.MoveNext
Loop While Not (rcd.EOF)
End With
End If
.
- Follow-Ups:
- Prev by Date: Re: isnumeric compile error...
- Next by Date: Re: Global variable losing value for no apparent reason
- Previous by thread: Locked Access Database - ldb files problem
- Next by thread: Re: Global variable losing value for no apparent reason
- Index(es):
Relevant Pages
|