Hi all,
I have several issues with my form. I designed a command button for saving the actual record and doing more things in background, please take a look:
These are my problems:
Ivan
I have several issues with my form. I designed a command button for saving the actual record and doing more things in background, please take a look:
Code:
Private Sub Command194_Click()
On Error GoTo Err_Command194_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Date = Date
Me.Local_Time = Time()
If Me.Reporter_s_surname = Null Then
MsgBox "Please enter your surname."
Else: DoCmd.Close
End If
Exit_Command194_Click:
Exit Sub
Err_Command194_Click:
MsgBox Err.Description
Resume Exit_Command194_Click
End Sub
These are my problems:
- Automatic filling of time works perfectly, but the date doesn't work...
Everytime I write the expression Date() after =, VBA puts away the parentheses automatically. I tried to rename the assigned field, cos I thought this may cause a problem, but nothing changed, it still puts Date instead of Date() and the command doesn't work then.
- I tried to design my own error message if there is a null value for mandatory field (Reporter_s_surname), but it doesn't work.
- I also need to design a code for one check box, which has to be automatically checked after administrator (manager in my case) opened and saw the particular record.
Simply: if the form with the particular record was opened, check box 'Validated' must be automatically checked to yes for that record. - I also have to design an if clause that if a particular check box is checked as yes then several other fields have to become mandatory (required), but I wasn't able to find any command for it in VBA.
- The last issue is that I have to design an indicator of the number of non-validated records in my 'Main Switchboard' form. I thought I would use 3 text boxes with different background colour in this way:
if there are less than 20 unseen records the green text box will become visible;
if between 20 and 50 yellow will become visible; and
if more than 50 red text box will be visible.
I have no idea how to program this. Probably I will need to use something like SUM for the 'Validated' check box field, but I wasn't able to find the solution.
Ivan