Help

T

Tom

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
 
G

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));
 
J

John Vinson

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]
 
T

Tom

Thank you for your time, help and input.
Tom
John Vinson said:
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


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]
 
T

Tom

Thank you for your time, help and input.
Tom
John Vinson said:
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


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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top