Howdy, Stranger!

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

Categories

HEEEEELP!!! Need help with a DATE...

hi
im using the following code with an Acess(jet 4.0) databse. i get the date input from the user as string in input boxes and then convert it to date but the find command just isn't working

Adodc1.Refresh ' ADO control
recTable.MoveLast ' rectable is a pointer to adodc1.recordset
recTable.MoveFirst
msg = CStr(ddate)
recTable.Find "Date=#msg#"

i also tried 'msg' and #'msg'# . nothing works. any ideas. maybe i should try '#msg#'???? or something else. the command works fine if i give a proper date like :
recTable.Find "Date=#27/1/2004#"

Comments

  • GideonOmegaGideonOmega Member Posts: 617
    : hi
    : im using the following code with an Acess(jet 4.0) databse. i get the date input from the user as string in input boxes and then convert it to date but the find command just isn't working
    :
    : Adodc1.Refresh ' ADO control
    : recTable.MoveLast ' rectable is a pointer to adodc1.recordset
    : recTable.MoveFirst
    : msg = CStr(ddate)
    : recTable.Find "Date=#msg#"
    :
    : i also tried 'msg' and #'msg'# . nothing works. any ideas. maybe i should try '#msg#'???? or something else. the command works fine if i give a proper date like :
    : recTable.Find "Date=#27/1/2004#"
    :
    :


    you need to change it to this:
    [code]
    recTable.find "Date=#" & msg & "#"
    [/code]

    any var's used in ADO or SQL need to be concatinated into your strings like shown above.

    I havn't used many of the conversion function so I might be wrong but should it be CStr(date) instead of CStr(ddate)?
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

  • hard_wiredhard_wired Member Posts: 2
    Thanks. it's working now... and ddate is just a DATE variable. forgot to mention that.


    : you need to change it to this:
    : [code]
    : recTable.find "Date=#" & msg & "#"
    : [/code]
    :
    : any var's used in ADO or SQL need to be concatinated into your strings like shown above.
    :
    : I havn't used many of the conversion function so I might be wrong but should it be CStr(date) instead of CStr(ddate)?
    : [blue]
    : C:Dos
    : C:Dos Run
    : Run Dos Run
    : [/blue]
    :
    :

Sign In or Register to comment.