Cant get this to work!!

Im making a program that has to find one particular date on a table, but i cant get it to work, i dont know if the syntax is well or what is going on wrong.

I also want to know if after the where clause I can use a comparison
for example:

("select * from Ventas where fecha_v =" & Date & " and codigo = " & txtcod.text & "")

DataEnvironment1.Connection1.Open
sqltext1 = ("select * from Ventas where fecha_v =" & Date)
Set rs = DataEnvironment1.Connection1.Execute(sqltext1)
If rs.RecordCount = 1 Then......

Comments

  • [b][red]This message was edited by infidel at 2002-10-11 15:6:31[/red][/b][hr]
    : Im making a program that has to find one particular date on a table, but i cant get it to work, i dont know if the syntax is well or what is going on wrong.
    :
    : I also want to know if after the where clause I can use a comparison
    : for example:
    :
    : ("select * from Ventas where fecha_v =" & Date & " and codigo = " & txtcod.text & "")

    This should work just fine, but you need to put single-quotes around any non-numeric values:

    [code]
    strSQL = "select * from Ventas " & _
    "where fecha_v = '" & Date & "' " & _
    "and codigo = '" & txtcod.text & "'"
    [/code]

    You probably want to also make sure the Date value is in the correct format, i.e. Format(Date,"MM/DD/YYYY")

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion