VB Newbie Question (1 Viewer)

AC5FF

Registered User.
Local time
Today, 16:16
Joined
Apr 6, 2004
Messages
552
I am trying to modify an existing program and have run into difficulties... I'm new at working with VB but roughly understand what is happening.

I'm only having issues with one WHERE clause ... I am pretty sure if I can modify this where clause correctly I can figure the rest of this program out. It is just killing me that I can't make it past this one step!! :banghead:

Forgive me, but I don't have access to the program currently, i'm going off of memory. My current where clause looks something like this:
WHERE table.IA = "Yes"

Having this line in the program returns 2 results - as expected. However I need to query different fields, so I've re-written my where clause to:
WHERE table.Status = "Active"

This line will return 209 results - again this is expected and correct. However I have to narrow this even further, so I then added:
WHERE table.Status = "Active" AND table.dcc <> ""

This now returns 0 results. The dcc field is a text field with data that would look like DCC-001, DCC-002, etc... Some records are blank, and those are the ones I wish to ignore. Out of the 209 "Active" records, only 69 have DCC entries.

I've tried DBNUL, ISDBNUL (I think spelling here is right) and a few other variants without any luck. I've even tried using a wild card like table.dcc = "DCC*" ... Not sure if that is even allowed, but figured I would try it. Again, no luck.

Thought I would ask here because I've gotten great help in the past with normal Access queries/etc issues I have run into.

Any Ideas??
 

plog

Banishment Pending
Local time
Today, 16:16
Joined
May 11, 2011
Messages
11,611
There's a difference between blank and "". To test for non-blank data use this:

tablA.dcc Is Not Null
 

AC5FF

Registered User.
Local time
Today, 16:16
Joined
Apr 6, 2004
Messages
552
This works if I run a query in access, but VB does not like "Null"
 

AC5FF

Registered User.
Local time
Today, 16:16
Joined
Apr 6, 2004
Messages
552
The boss gave me a few suggestions and I went to try those (i.e. using IsEmpty or IsNull with an IF statement). Neither option worked. I'm running VB 2010 Express and it did not like either of those two statements.

So I have totally abandoned this approach.

As I think I mentioned earlier I am modifying an existing program. Well, that program uses an IA field out of an Access database. What I figured I would do was just to add another column to my existing table in the database and use a flag to say if I want to use that row's information or not. Same way the IA field is used.

Adding the column and updating the flags was no problem. But I cannot just go into VB and use that field - correct? I seem to remember needing to add that column from the table in VB somehow - but cannot remember how to do that.

So; if anyone can point me to a good walkthrough on adding new columns from an access table into VB - I would appriciate it! That will get me moving a long way! (I hope!)
 

AC5FF

Registered User.
Local time
Today, 16:16
Joined
Apr 6, 2004
Messages
552

Plog;
So, reading this site; it says that IsNull applies to Access 2010, etc.. But what about Visual Basic 2010 Express? Honestly, i'm not sure of the difference - but I had to ask.

On the page it gives this as an example:

Dim LValue As Boolean
LValue = IsNull("Tech on the Net") 'LValue would be FALSE

Here is my question; can I write this line like this?
Dim LValue As Boolean
LValue = IsNull(propertyData.DCC)

To get a False when DCC has data and TRUE when it is empty? Basically calling out my field name instead of a text string.

This is going back to my original approach - but still worth investigating.
 

Users who are viewing this thread

Top Bottom