Create a table called tblDate, & set it to system, hidden. That way it will be a little harder to find, although I would recommend making it into an MDE & not allowing the users access to the database window. Within the table, two fields, called InitialDate & ExpiryDate.
Sub CheckDates()
dim db as database, rst as recordset, dteInitial as date dteExpire as date, DaysRemaining as integer
set db = currentdb
rst = db.openrecordset (SELECT * FROM tblDate)
if rst.recordcount > 0 then 'If a record exists, the sub has executed previously
dteexpire = rst!expirydate
if datediff("d", Date, dteExpire) < 1 then 'Will be accurate to the nearest day
msgbox "The trial period has expired"
docmd.quit
else
DaysRemaining = datediff("d", date, dteexpire)
msgbox "You have " & daysremaining & " days remaining" 'Tell the user how many days remain in their trial
endif
else
rst.addnew 'You might need to add an rst.edit before this line
rst!dteinitial = date
rst!dteexpire = DateAdd("d", 7, dteinitial)
rst.update
endif
HTH
James Goodman
j.goodman00@btinternet.com