Mar 23, 2004 #1 RealKiwi Technical User Feb 26, 2004 41 NZ Is there a VBA eqivalent to the 'In' SQL keyword, or am I resigned to using lengthy 'or' statements? Code: SELECT * FROM tblName WHERE fieldname IN ('ax', 'bx', 'cx', dx') thanks
Is there a VBA eqivalent to the 'In' SQL keyword, or am I resigned to using lengthy 'or' statements? Code: SELECT * FROM tblName WHERE fieldname IN ('ax', 'bx', 'cx', dx') thanks
Mar 23, 2004 #2 vbajock Programmer Jun 8, 2001 1,921 US If your dealing with a set of data like 'ax', 'bx', 'cx', dx', the Split function comes in pretty handy. Is in the help file. Upvote 0 Downvote
If your dealing with a set of data like 'ax', 'bx', 'cx', dx', the Split function comes in pretty handy. Is in the help file.
Mar 23, 2004 #3 PHV MIS Nov 8, 2002 53,708 FR And what about something like this? Select Case varname Case "ax", "bx", "cx", "dx" ' Your code here End Select Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
And what about something like this? Select Case varname Case "ax", "bx", "cx", "dx" ' Your code here End Select Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Mar 23, 2004 Thread starter #4 RealKiwi Technical User Feb 26, 2004 41 NZ Yet another cryptic help file from Microsoft... not surprise there ;-) Upvote 0 Downvote
Mar 23, 2004 Thread starter #5 RealKiwi Technical User Feb 26, 2004 41 NZ Thanks PHV, I had that in mind; even had the 6 code lines to do the job. 'In' is so much cleaner! Upvote 0 Downvote
Mar 24, 2004 #6 vbajock Programmer Jun 8, 2001 1,921 US If the help files are too cryptic, buy a book Upvote 0 Downvote
Mar 24, 2004 #7 Golom Programmer Sep 1, 2003 5,595 CA You can also use InStr to cheat a bit for strings. [blue][tt] If Instr ( "ax?bx?cx?dx?", myString & "?" ) > 0 then [/tt][/blue] Upvote 0 Downvote
You can also use InStr to cheat a bit for strings. [blue][tt] If Instr ( "ax?bx?cx?dx?", myString & "?" ) > 0 then [/tt][/blue]