CONDITIONAL MACRO

  • Thread starter Thread starter Bartman
  • Start date Start date
B

Bartman

Hi,

Can anyone help?

I have a form with two dates on it.
One is todays date (now) and the other is the last date the main table
was updated on (then).

I want to put a conditional macro that will run the main table when the
form is opened if the last table run date (then) is less than today
(now).

Can anyone show me how this can be achieved?
 
There are no events associated with tables. You can build a table that will
store a date when a form is closed and check that table when that same form
is opened. I'm not sure how you could do that in a macro, but it is simple
in VBA code (untested):

Sub Form_Open()
If DMax("DateField", "MyTable") = Date Then
DoCmd.OpenForm "Form1"
Else
' do something else
End If
End Sub

Sub Form_Close()
CurrentDb.Execute "Insert Into MyTable(DateField) Values (Date())
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Basically I have a appened table qry that needs to be run at the start
of each day to build data in a table.

The table is then viewed by approx 50 staff so needs to be updated in
the morning.

I heard about conditional macros and wanted to attach one to the form
that each of the 50 members of staff use. On the form I have two dates
one is todays date the other is the date the table was last updated on.

I wanted to have the condition on the macro to look at both dates and
if a difference existed between them then a further macro is run that
updates the table.

Ps. I have not used VB before.
 
Hi,

I basically want to run a macro I have made if the two dates on a form
are different.
I assumed that using a conditional macro to look at the two dates, if
they were different I could get the main macro to run.

The main macro simply runs an append query to build a table.

The table needs to be updated each day and the data in the table is
viewed by approx 50 staff.
Ps. I have no VB knowledge.
 

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

Back
Top