Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time error 438

Status
Not open for further replies.

mohecan84

MIS
Dec 7, 2011
13
ZA
Hi Guys,

Have a bit of a problem with a script I am trying to run. I am asking my script to run through a list in the current form but the script cannot recognize the form. the script looks as follows.

Form name is "Coaching and Training Logger"

Private Sub cmdSubmit_Click()


Dim EnteredError As String
Dim ErrorSummary As String
Dim MessageTitle As String
Dim oItem As Variant
Dim CallCentreAgentsTemp1 As String
Dim SubCategoryTemp1 As String

Me.Refresh


CallCentreAgentsTemp1 = ""
SubCategoryTemp1 = ""

EnteredError = 0

For Each oItem In Forms![Coaching and Training Logger]!lstAgents.ItemSelected
If iCount = 0 Then
CallCentreAgentsTemp1 = Forms![Coaching and Training Logger]!lstAgents.ItemData(oItem)
End If
iCount = iCount + 1
Next oItem

iCount = o

If Me.txtStartDate = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Start Date" & vbCrLf
End If

If Me.txtEndDate = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - End Date" & vbCrLf
End If

If Me.cboEmployee = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Coach/Trainer" & vbCrLf
End If

If Me.cboType = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Type" & vbCrLf
End If

If Me.cboDepartment = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Department" & vbCrLf
End If

If Me.cboCategory = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Category" & vbCrLf
End If

If Me.lstAgents = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Agents" & vbCrLf
End If

If Me.lstSubCategory = "" Then
EnteredError = 1
ErrorSummary = ErrorSummary & " - Sub-Category" & vbCrLf
End If

If EnteredError = 1 Then
ErrorSummary = "The Following Fields are Required: " & vbCrLf & vbCrLf & ErrorSummary
MessageTitle = "Action Required!"
MsgBox ErrorSummary, vbInformation, MessageTitle
End If

iCount = 0

If EnteredError <> 1 Then

'Add Data to Table

CurrentDb.Execute "INSERT INTO Logdata(Logtime,StartTime,EndTime,Employee,Type,Department,Category,MethodUsed,CallCentreAgent1)" & "VALUES('" & Now() & "','" & Me.txtStartDate.Value & "','" & Me.txtEndDate.Value & "','" & Me.cboEmployee.Value & "','" & Me.cboType.Value & "','" & Me.cboDepartment.Value & "','" & Me.cboCategory.Value & "','" & Me.cboMethodUsed.Value & "','" & CallCenterAgentTemp1 & "')"
'Clear form
cmdClear_Click
End If

End Sub

Any help would really be appreciated.

kind regards,
MG
 
For Each oItem In Forms![Coaching and Training Logger]!lstAgents.Item[!]s[/!]Selected

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
HI PHV,

I was going through each line and saw that. Thank you very much for your help.

kind regards,

MG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top