|
Hi (again!) thanks to the help of many forum members i have built a system for our users. I have a facility that allows users to do an end of month submission and it writes the date selected into a field called 'datelastsubmitted' in 'tblusers'. the reason i am doing this is that i do not want users to then be able to go in and edit any activity that they have entered prior to that 'datelastsubmitted' value. When they open up an activity to edit (as opposed to creating a new one) i want to be able to restrict them from editing the activity if the 'datelastsubmitted' value is more recent than the 'activitydate' value. this form is based on a query between linked tables so datelastsubmitted and activitydate are able to be compared
However i dont know how to get this to compare the 2 dates and then allow or disallow editing (which is done by pressing the 'activityedit' command button).
An example is below
(This sets the form to be non-editable by default)
Private Sub Form_Load() Me.AllowEdits = False
End Sub
Ive then been trying to tell this button to disallow editing if the 'datelastsubmitted' value is greater than the 'activitydate' value but i guess it doesnt work this way.
Private Sub activityedit_Click() Dim datelastsubmitted As Date Dim activitydate As Date If "#Me!datelastsubmitted.value# Is >= #Me!activitydate.value#" Then _ Me.AllowEdits = False ElseIf "#Me!datelastsubmitted.value# Is <= #Me!activitydate.value#" Then Me.AllowEdits = True End If End Sub
It also tells me that there is a type mismatch on the lines "If blah blah blah blah Then"
Can anyone tell me how it should be done?
Thanks again,
Rhys. |