how to enter new data in a form

rutica

Registered User.
Local time
Today, 14:38
Joined
Jan 24, 2008
Messages
87
I'm using Access 2003.

I have a feeling I'm not on the right path.. Can someone look at my attached database and let me know what you think?

My purpose is to create a database where Measures data is collected monthly. There are Data Owners assigned to different measures. Monthly, when the Data Owner opens the database, I want them to be shown only their Measures in a form. They will be required to enter data for the month in that Form.

So, for example, in April, the data owner will log into the database and be shown a form only for his Measures (I'll have to figure out how to set security). He will enter data in the Result and Mitigation fields shown on the attached frmInputForm. He can go back and change the data as often as he wishes, but when April finishes, the form becomes Read Only. Then, in May, he will open the database and fill out the data for May.

I'm confused about how to display the April data to be ready for the user to enter their values. I entered sample March data straight into the table. But how do I display the April data? If you click on my 'Enter new data' button, you get a blank form.

Help!
 

Attachments

In your forms' On Current event try something like;
Code:
    If [URL="http://www.techonthenet.com/access/functions/date/datepart.php"]DatePart[/URL]("m", Me.YourDateField) = DatePart("m", Date) And DatePart("yyyy", Me.YourDateField) = DatePart("yyyy", Date) Then
        Me.AllowAdditions = True
        Me.AllowDeletions = True
        Me.AllowEdits = True
    Else
        Me.AllowAdditions = False
        Me.AllowDeletions = False
        Me.AllowEdits = False
    End If
 
Thanks for writing. In my frmInitial, I have the following code for my date combo box:

If Now() > AsOfDate Then
DoCmd.OpenForm "frmInputForm", , , "[AsOfDate]=" & "#" & Me![cboExistingData] & "#", acFormReadOnly
MsgBox "This form is read only"
Else
DoCmd.OpenForm "frmInputForm", , , "[AsOfDate]=" & "#" & Me![cboExistingData] & "#"
End If

So my question isn't how to show Read Only when the date has passed.

My question is how to fill in a form with the fields: Area, Metric, SubMeasure ID, SubMeasure, Target, % Var from Plan, and TrafficLight, when it's time to enter new data in a new month. So in my frmInitial, if you click on Enter New Data, you get a completely blank form. How will the user enter data without knowing the Area, Metric, SubMeasure, etc. I want to have the fields mentioned above displayed so the user can enter data in the Result and Mitigation fields.

In other words, when the user clicks 'Enter New Data' I want to see a form where Area, Metric, SubMeasure ID, SubMeasure, Target, % Var from Plan, and TrafficLight are all filled in. AsOfDate should also be filled in with 4/30/2010. The only blank fields would be Result and Mitigation.

Then in May, the same thing would happen, only AsOfDate would be 5/30/2010.

(The fields Target, %Var From Plan and Traffic Light might change monthly, but that will be entered behind the scenes.)

Thanks!
 
First up unless you specifically need a time component in your date data, avoid using Now() (which returns the current time as well as date) use the Date() function instead which will simply return the current date.

As for pre-populating your field you should be able to use the logical test I provided earlier to determine if you need to force values into your required values, something like;
Code:
    If DatePart("m", Me.YourDateField) = DatePart("m", Date) And DatePart("yyyy", Me.YourDateField) = DatePart("yyyy", Date) Then
        Me.Target= [COLOR="DarkOrchid"]Value you want in this field[/COLOR]
        [COLOR="SeaGreen"]'And so on[/COLOR]
    End If
 

Users who are viewing this thread

Back
Top Bottom