Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Refresh Table on open

Discussion in 'Information Technology' started by Les, Jul 28, 2006.

  1. Les

    Les
    Expand Collapse
    Guest

    Hello all, i am not a programmer and need some help with some VBA code
    please.

    I have a table called "tbl_DbInfo" it has another field called
    "LastImportDate"

    What i need to do is, an if statement to see if the date in the table
    is less than todays date, if it is then run the Re-fresh code and
    insert todayd date in the table. If not just carry on.

    I will be ever indebted for help..

    thanks in advance
     
  2. Loading...

    Similar Threads Forum Date
    As A Child, Public Marches Of Sikhism Made Me Uncomfortable. They Still Do . Why ? Whats The Logic Hard Talk Oct 16, 2016
    Arts/Society Backyard Vegetable Garden Language, Arts & Culture Dec 27, 2013
    Heritage Now a Vegetable Market, Ranjit Singh's Royal Haveli a Picture of Neglect History of Sikhism Nov 11, 2013
    Sikhism Helium: 1984 and the "Periodic Table of Hate" (Jaspreet Singh) Book Reviews & Editorials Oct 28, 2013
    Heritage How our entire history was dumped in a horse stable History of Sikhism Oct 28, 2013

  3. deluxeinformation@gmail.com

    deluxeinformation@gmail.com
    Expand Collapse
    Guest

    Les wrote:
    > Hello all, i am not a programmer and need some help with some VBA code
    > please.
    >
    > I have a table called "tbl_DbInfo" it has another field called
    > "LastImportDate"
    >
    > What i need to do is, an if statement to see if the date in the table
    > is less than todays date, if it is then run the Re-fresh code and
    > insert todayd date in the table. If not just carry on.
    >
    > I will be ever indebted for help..
    >
    > thanks in advance


    I'm assuming that this table has only one record in it. If so then the
    following should work:

    dim rst as recordset

    set rst = currentdb.openrecordset("tbl_DbInfo")
    if rst!LastImportDate < format(now,"m/d/yyyy") then
    ' run refresh code
    rst.Edit
    rst!LastImportDate = format(now,"m/d/yyyy")
    rst.Update
    endif

    rst.close
    set rst = nothing


    Hope this helps.
    Bruce
     
  4. Les

    Les
    Expand Collapse
    Guest

    Thanks so much Bruce, sorry for late reply --- Time zones ---

    deluxeinformation@gmail.com wrote:
    > Les wrote:
    > > Hello all, i am not a programmer and need some help with some VBA code
    > > please.
    > >
    > > I have a table called "tbl_DbInfo" it has another field called
    > > "LastImportDate"
    > >
    > > What i need to do is, an if statement to see if the date in the table
    > > is less than todays date, if it is then run the Re-fresh code and
    > > insert todayd date in the table. If not just carry on.
    > >
    > > I will be ever indebted for help..
    > >
    > > thanks in advance

    >
    > I'm assuming that this table has only one record in it. If so then the
    > following should work:
    >
    > dim rst as recordset
    >
    > set rst = currentdb.openrecordset("tbl_DbInfo")
    > if rst!LastImportDate < format(now,"m/d/yyyy") then
    > ' run refresh code
    > rst.Edit
    > rst!LastImportDate = format(now,"m/d/yyyy")
    > rst.Update
    > endif
    >
    > rst.close
    > set rst = nothing
    >
    >
    > Hope this helps.
    > Bruce
     

Share This Page