|
-
Mar 1st, 2005, 01:33 PM
#1
Thread Starter
Frenzied Member
VBA Access Searching...
Hey,
I am looking for a way to search a table of only 2 columns. The first column will have the numbers I am searching and the second column with have descriptions of those numbers. Some of the numbers are yet to recieve descriptions. I would like to be able to perform a search a for a number and return whether or not it has a description. Anyone have a decent idea on how to do this?
Thanks
-
Mar 1st, 2005, 03:31 PM
#2
Re: VBA Access Searching...
VB Code:
"SELECT Col1, Col2 FROM Table1 WHERE Col2 = '';"
DEpends on your Col2 field data type. If its text then that will work.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 2nd, 2005, 06:10 AM
#3
Re: VBA Access Searching...
Depends on how you are outputting it.
if straight from Sql (bound for example)
Code:
"SELECT Col1, iif(nz(len(Col2),0)=0,"-- Not Set --",Col2) FROM Table1"
If you are looping through code then put a check for isnull and for zero length. If its either of these then print up "--not set--" in that part, otherwise put in the fields contents
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Mar 2nd, 2005, 01:05 PM
#4
Thread Starter
Frenzied Member
Re: VBA Access Searching...
Well I am getting a number from a form then I want to search column 1 to make sure its there, if its there I need to know if it has a description in column2. I would like to be able to have a msgbox pop up if the number not found or if the number is found and there is no description...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|