View Full Version : VB condition Static value or dynamic value from the field


NPUser
07-11-2006, 01:37 PM
How do i do this in VB? Here is my suitation, I need some guidence from VB pros.

I have yes or no question if yes - then use text entered as static text in query else use a field from the table in the query.

Y/N = 'Y'

select 'Test01' as Exp1, a.id_num from tblTest a

Y/N = 'n'
select a.crs_cde, a.ID_NUM from tblTest a


this is what i came up with. But does not do anything.


WScript.StdOut.Writeline
WScript.StdOut.Write "Replace word with new word(e.g. y/n) and press Enter: "
u_Ryn = WScript.StdIn.Readline

if u_Ryn = "y" then
WScript.StdOut.Writeline
WScript.StdOut.Write "Enter new word (e.g. IDS_110) and press Enter: "
u_BBCrsName = WScript.StdIn.Readline

R_crs = u_BBCrsName
else
R_crs = tbltest.crs_cde

end if

comm.commandtext="SELECT " & R_Crs & "as Test01, a.ID_NUM from tblTest a"
set rs = execute()
end if
..
.
.
..

NPUser
07-12-2006, 07:34 AM
Got it. Never mind