hiya every1, (access 2k3)
quick easy question, as im a noob when it comes to coding/vb.
Within our company database we have the usual timesheet table. With the table I have create a query (called "dailytimeforkeith") that gives me the sum of time for an individual person for one day (in fact its the previous day). What I have done then is created a form (called "keithyesterdaytime") that shows this query entry (called "sumoftimespent").
Each user has a different database screen logon and forms that are present when they log in. So what I then done is on one of these forms the load up, i attached this:
Private Sub Employee_Enter()
Me.Employee = User.FirstName
If Me.Employee = "Keith" Then
Dim stdocname As String
stdocname = "keithyesterdaytime"
DoCmd.OpenForm stdocname, , , acAdd
............
then on "keithyesterdaytime" opening the following code runs
------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim internal1 As Integer
internal1 = Forms!keithyesterdaytime.SumOfTimeSpent
If internal1 < 6 Then
DoCmd.Close
MsgBox " Less than 6 hours have been entered " & Chr(13) & " into your timesheet for yesterday. ", vbCritical, Title1
Else
DoCmd.Close
End If
End Sub
-------------------------------------------------------
Whenever i logon with the user keith, i get the following error 'runtime error 2427: You entered an expression that has no value.
If I open the form "keithyesterdaytime" on its own, the code works and i dont get an error.
What have i done wrong, and be gently. HEHEHE. Also is there any easy way i can do this instead of having to create the the form "keithyesterdaytime"
quick easy question, as im a noob when it comes to coding/vb.
Within our company database we have the usual timesheet table. With the table I have create a query (called "dailytimeforkeith") that gives me the sum of time for an individual person for one day (in fact its the previous day). What I have done then is created a form (called "keithyesterdaytime") that shows this query entry (called "sumoftimespent").
Each user has a different database screen logon and forms that are present when they log in. So what I then done is on one of these forms the load up, i attached this:
Private Sub Employee_Enter()
Me.Employee = User.FirstName
If Me.Employee = "Keith" Then
Dim stdocname As String
stdocname = "keithyesterdaytime"
DoCmd.OpenForm stdocname, , , acAdd
............
then on "keithyesterdaytime" opening the following code runs
------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim internal1 As Integer
internal1 = Forms!keithyesterdaytime.SumOfTimeSpent
If internal1 < 6 Then
DoCmd.Close
MsgBox " Less than 6 hours have been entered " & Chr(13) & " into your timesheet for yesterday. ", vbCritical, Title1
Else
DoCmd.Close
End If
End Sub
-------------------------------------------------------
Whenever i logon with the user keith, i get the following error 'runtime error 2427: You entered an expression that has no value.
If I open the form "keithyesterdaytime" on its own, the code works and i dont get an error.
What have i done wrong, and be gently. HEHEHE. Also is there any easy way i can do this instead of having to create the the form "keithyesterdaytime"