Welcome to SPN

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

Sign Up Now!

Help

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

Tags:
  1. Tom

    Tom
    Expand Collapse
    Guest

    Hi all,

    2 questions here:

    Can I control visibility of a form from a different form? If yes - how?
    I have form1 and form2. Form1 is invisible, On form2 I have a button, when I
    click it I need form1 to show.


    I need to delete all the records which are 60 days old from tblOrders . the
    field is OrderDate.
    what is the right syntax of the sql statment?


    Thanks for the help,
    Tom
     
  2. Loading...


  3. kabaka

    kabaka
    Expand Collapse
    Guest

    #1) I am assuming form1 is open: in the OnClick event of you button on form2
    Sub btn1_OnClick()
    dim boo as boolean
    boo = forms!("Form1").visible
    Forms!("Form1").visible = not boo
    End Sub


    #2) Did you mean equals 60 days or greater than 60 days? Just change the
    ">" to "=" if necessary:

    DELETE [tblOrders].*FROM [tblOrders] WHERE
    (((DateDiff("d",[OrderDate],Date()))>60));


    "Tom" wrote:

    > Hi all,
    >
    > 2 questions here:
    >
    > Can I control visibility of a form from a different form? If yes - how?
    > I have form1 and form2. Form1 is invisible, On form2 I have a button, when I
    > click it I need form1 to show.
    >
    >
    > I need to delete all the records which are 60 days old from tblOrders . the
    > field is OrderDate.
    > what is the right syntax of the sql statment?
    >
    >
    > Thanks for the help,
    > Tom
    >
    >
    >
     
  4. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Mon, 19 Jun 2006 13:08:14 -0400, "Tom" <partner1973@yahoo.com>
    wrote:

    >Hi all,
    >
    >2 questions here:
    >
    >Can I control visibility of a form from a different form? If yes - how?
    >I have form1 and form2. Form1 is invisible, On form2 I have a button, when I
    >click it I need form1 to show.


    Sure: you'll need to use the OpenForm method to bring the form "to the
    front" as well:

    Private Sub cmdShowForm2_Click()
    DoCmd.OpenForm "Form2", <optional arguments>
    Forms!Form2.Visible = True
    End Sub

    >
    >I need to delete all the records which are 60 days old from tblOrders . the
    >field is OrderDate.
    >what is the right syntax of the sql statment?


    Well... think about this. What if a customer calls up and says "I
    bought a widget three months ago, and I was overcharged." What about
    year-end summaries? What about taxes? Is your database in fact
    approaching 2 billion bytes, or is performance irretrievably
    declining?

    If you still DO want to permanently, irrevokably delete records, the
    SQL is

    DELETE * FROM tblOrders WHERE OrderDate < DateAdd("d", -60, Date())

    John W. Vinson[MVP]
     
  5. Tom

    Tom
    Expand Collapse
    Guest

    Thank you for your time, help and input.
    Tom
    "John Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
    news:rbud925t8hed9vbpc25s3jdc5id54loljv@4ax.com...
    > On Mon, 19 Jun 2006 13:08:14 -0400, "Tom" <partner1973@yahoo.com>
    > wrote:
    >
    >>Hi all,
    >>
    >>2 questions here:
    >>
    >>Can I control visibility of a form from a different form? If yes - how?
    >>I have form1 and form2. Form1 is invisible, On form2 I have a button, when
    >>I
    >>click it I need form1 to show.

    >
    > Sure: you'll need to use the OpenForm method to bring the form "to the
    > front" as well:
    >
    > Private Sub cmdShowForm2_Click()
    > DoCmd.OpenForm "Form2", <optional arguments>
    > Forms!Form2.Visible = True
    > End Sub
    >
    >>
    >>I need to delete all the records which are 60 days old from tblOrders .
    >>the
    >>field is OrderDate.
    >>what is the right syntax of the sql statment?

    >
    > Well... think about this. What if a customer calls up and says "I
    > bought a widget three months ago, and I was overcharged." What about
    > year-end summaries? What about taxes? Is your database in fact
    > approaching 2 billion bytes, or is performance irretrievably
    > declining?
    >
    > If you still DO want to permanently, irrevokably delete records, the
    > SQL is
    >
    > DELETE * FROM tblOrders WHERE OrderDate < DateAdd("d", -60, Date())
    >
    > John W. Vinson[MVP]
     

Share This Page