Passing Date Values

kermit5

Registered User.
Local time
Today, 16:16
Joined
Nov 2, 2001
Messages
122
I intend to issue a trial version of my software. I have a table, tblRegistry, that I want to contain the installation date, and the length of the trial period.

My frmRegistry has qryRegistry as it's record source. This query calculates the number of days remaining by calculating the difference between today's date and the installation date and subtracting that from the trial period.

The problem that I have is setting the installation date the first time the software is opened. The frmRegistry is opened via my autoexec macro everytime the software is opened. Here is my code for the OnOpen Event:


Private Sub Form_Open(Cancel As Integer)
If IsNull(Forms!frmRegistry!InstallationDate) Then
Me.InstallationDate = Date
Else
' Forms!frmRegistry!DaysRemaining = Forms!frmRegistry!TrialPeriod - (Now() - Forms!frmRegistry!InstallationDate)
If Forms!frmRegistry!DaysRemaining = 0 Then
MsgBox "Your trial period has expired" & vbCrLf & _
"Please call (801) 680-2943 to purchase your copy of IMS Software", vbOKOnly, "Expiration of Trial Period"
DoCmd.Quit
End If
End If
End Sub


When I run this code, I get a runtime error #-2147352567 (80020009) "You cant assign a value to this object.

What am I missing?
 
Is the problem that the macro is run every time? Does it run correctly the first time, and then fail from then on? Or do you mean that it doesn't run right even the first time through?

Matt
 
The code does not even run correctly the first time.

If I manually put a date value in the installationdate field, my code works well. The problem I have is automatically entering today's date the first time the software is opened.
 
What is the difference between on load and on open?
 
kermit5 said:
What is the difference between on load and on open?

Select either event of the form: both Open and Load - press F1 and find out.
 

Users who are viewing this thread

Back
Top Bottom