Mar 23, 2004 #1 RealKiwi Technical User Joined Feb 26, 2004 Messages 41 Location 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 Joined Jun 8, 2001 Messages 1,921 Location 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 Joined Nov 8, 2002 Messages 53,708 Location 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 Joined Feb 26, 2004 Messages 41 Location NZ Yet another cryptic help file from Microsoft... not surprise there ;-) Upvote 0 Downvote
Mar 23, 2004 Thread starter #5 RealKiwi Technical User Joined Feb 26, 2004 Messages 41 Location 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 Joined Jun 8, 2001 Messages 1,921 Location US If the help files are too cryptic, buy a book Upvote 0 Downvote
Mar 24, 2004 #7 Golom Programmer Joined Sep 1, 2003 Messages 5,595 Location 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]