Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $95

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page