Time fixed for form

meenctg

Learn24bd
Local time
Today, 06:32
Joined
May 8, 2012
Messages
133
I have a Welcome form which i have set at startup. I want to set this form for a fixed tme (ex: 30days or more or anythings) when the fixed time will expire then another form will show at startup.

Any one help me about this problem?
 
create a table with a Frequency Field and value = 30 and Welcome Screen OnOpen Add Code:

Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - 1"
if dlookup("Frequency ","TableName") = 0 then
cancel = true
docmd.openform "frm2"
end if
 
create a table with a Frequency Field and value = 30 and Welcome Screen OnOpen Add Code:

Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - 1"
if dlookup("Frequency ","TableName") = 0 then
cancel = true
docmd.openform "frm2"
end if

It works! but not for day.
It is working for every file opening. If i set the value of Frequency 4. It works for just 4 times file opening. But i have need for days not for file opening.

Tnx for help
if you can give the solution it'll be help for me.
 
Add field LastDateOpened,

Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& DateDiff("D",[LastDateOpened],Date) &""
 
FIXED.....

Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& DateDiff("D",[LastDateOpened],Date) &"


currentdb.execute "UPDATE TableName SET LastDateOpened = #" & Date &"#"
 
FIXED.....

Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& DateDiff("D",[LastDateOpened],Date) &"


currentdb.execute "UPDATE TableName SET LastDateOpened = #" & Date &"#"

i can do this please help me......
my table is tbl (two fields are 1. Frequency 2. LastDateOpened)
form name 1. welcome 2. frm2

i wanna validity for the welcome form just 4 days. after 4days later frm2 always will be open at start up
please help me how to apply the code .
 
in the tbl set Frequency = 4, LastDateOpened = Date (e.g. 6/17/2012)

In the welcome Form OnOpen Event add this code


Code:
' Set the value for the first time user is opening the DB
currentdb.execute "UPDATE tbl SET Frequency  = 4,LastDateOpened  = #" &date &"# WHERE Frequency is null or LastDateOpened  is null;"

currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& DateDiff("D",[LastDateOpened],Date) &"


currentdb.execute "UPDATE TableName SET LastDateOpened = #" & Date &"#"

if dlookup("Frequency ","tbl") = < 0 then
cancel = true
end if

docmd.openform "frm2"
 
in the tbl set Frequency = 4, LastDateOpened = Date (e.g. 6/17/2012)

In the welcome Form OnOpen Event add this code


Code:
' Set the value for the first time user is opening the DB
currentdb.execute "UPDATE tbl SET Frequency  = 4,LastDateOpened  = #" &date &"# WHERE Frequency is null or LastDateOpened  is null;"

currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& DateDiff("D",[LastDateOpened],Date) &"


currentdb.execute "UPDATE TableName SET LastDateOpened = #" & Date &"#"

if dlookup("Frequency ","tbl") = < 0 then
cancel = true
end if

docmd.openform "frm2"

I have done it according to your instructions but it shows
Run time error '2465'
attachment.php

and it shows error on this code
CurrentDb.Execute "UPDATE TableName SET Frequency = Frequency - " & DateDiff("D", [LastDateOpened], Date) & ""

i can understand what will i do. how to 'll i solve this? plz
 

Attachments

  • ddd.png
    ddd.png
    7.1 KB · Views: 283
Create a integer variable holding the DateDiff Value like:
dim a as Date
a = DateDiff("D",dlookup("Lastdateopened","tbl"),Date)


make sure the table name is updated with your table name
Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& a &" "
 
Create a integer variable holding the DateDiff Value like:
dim a as Date
a = DateDiff("D",dlookup("Lastdateopened","tbl"),Date)


make sure the table name is updated with your table name
Code:
currentdb.execute "UPDATE TableName SET Frequency = Frequency - "& a &" "

Would you give me any template ? please
 

Users who are viewing this thread

Back
Top Bottom