S
spieters via AccessMonster.com
L.S.
I'm getting the message "Object variable or with Block variable not set"
Im working with a project using a SQL server 2000.
This is the code I'm using. I'm more or less used to MDB but this APD is my
first.
Is there something wrong in the coding?
Dim bdd As DAO.Database
Dim rs As DAO.Recordset
Dim SQL As Variant
Dim stLinkCriteria As String
Dim datHireDate As Date
Dim strTitle As String
If Me.voucher_personnum = "" Or IsNull(Me.voucher_personnum) Then
MsgBox ("Error:.. Please enter a valid Employee Number")
Me.voucher_personnum.SetFocus
Exit Sub
End If
Set bdd = CurrentDb
Set rs = bdd.OpenRecordset("bd_kronos_dbo_VP_TOTALS", dbOpenTable)
datHireDate = Me.voucher_date
' Read Kronos to display Info if present
Set rs = Nothing
SQL = "Select bd_kronos_dbo_personnum, bd_kronos_dbo_applydate " & _
"FROM bd_kronos_dbo_VP_TOTALS Where bd_kronos_dbo_applydate = #" &
datHireDate & "# And bd_kronos_dbo_personnum = '" & Me.voucher_personnum &
"'"
' Set rs = bdd.OpenRecordset(SQL)'
If rs.EOF Then
MsgBox ("Error:.. Employee nbr or voucher date not in Kronos")
Me.voucher_personnum.SetFocus
Me.voucher_date.SetFocus
Set rs = Nothing
Set bdd = Nothing
Exit Sub
End If
Me.Emplname = rs.Fields("personnum")
If [timeinseconds] / 3600 >= 14.3 Then
MsgBox ("Employee heeft recht op 2(twee) overwerkbonnen")
End If
If [timeinseconds] / 3600 <= 14.3 Then
MsgBox ("Employee heeft recht op 1 (één) overwerkbon")
End If
Set rs = Nothing
Set bdd = Nothing
End Sub
Thanks in advance for your cooperation!
Stella
I'm getting the message "Object variable or with Block variable not set"
Im working with a project using a SQL server 2000.
This is the code I'm using. I'm more or less used to MDB but this APD is my
first.
Is there something wrong in the coding?
Dim bdd As DAO.Database
Dim rs As DAO.Recordset
Dim SQL As Variant
Dim stLinkCriteria As String
Dim datHireDate As Date
Dim strTitle As String
If Me.voucher_personnum = "" Or IsNull(Me.voucher_personnum) Then
MsgBox ("Error:.. Please enter a valid Employee Number")
Me.voucher_personnum.SetFocus
Exit Sub
End If
Set bdd = CurrentDb
Set rs = bdd.OpenRecordset("bd_kronos_dbo_VP_TOTALS", dbOpenTable)
datHireDate = Me.voucher_date
' Read Kronos to display Info if present
Set rs = Nothing
SQL = "Select bd_kronos_dbo_personnum, bd_kronos_dbo_applydate " & _
"FROM bd_kronos_dbo_VP_TOTALS Where bd_kronos_dbo_applydate = #" &
datHireDate & "# And bd_kronos_dbo_personnum = '" & Me.voucher_personnum &
"'"
' Set rs = bdd.OpenRecordset(SQL)'
If rs.EOF Then
MsgBox ("Error:.. Employee nbr or voucher date not in Kronos")
Me.voucher_personnum.SetFocus
Me.voucher_date.SetFocus
Set rs = Nothing
Set bdd = Nothing
Exit Sub
End If
Me.Emplname = rs.Fields("personnum")
If [timeinseconds] / 3600 >= 14.3 Then
MsgBox ("Employee heeft recht op 2(twee) overwerkbonnen")
End If
If [timeinseconds] / 3600 <= 14.3 Then
MsgBox ("Employee heeft recht op 1 (één) overwerkbon")
End If
Set rs = Nothing
Set bdd = Nothing
End Sub
Thanks in advance for your cooperation!
Stella