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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

13- Type mismatch

Status
Not open for further replies.

odessa79

Programmer
Sep 16, 2003
31
US
I get this error message and I can't figure out why here is the code where I get it.

'--------------------------
Private Sub Find_Employee()
'--------------------------
On Error GoTo errorhandler
Dim SQL As String
SQL = "select * from [Employee Data Table]" & _
"where [EMPID] = '" & strEmpid & "'"
Set gRSEmpData = gDB.OpenRecordset(SQL) ' Employee Data
While Not gRSEmpData.EOF
strOldGrp = gRSEmpData!EMP_GROUP
strOldCls = gRSEmpData!JobID
strOldJRT = gRSEmpData!JOB_RT
strOldRT = gRSEmpData!EMP_RT
strOldFP = gRSEmpData!EMP_FT
strOldStat = gRSEmpData!status
strOldStdt = gRSEmpData!STAT_DATE
strOldJobDt = gRSEmpData!JOB_START
strCheck = "true"
Call Update_Employee_Data_Table
gRSEmpData.MoveNext
Wend
If strEmpid > &quot;17000000&quot; And strCheck = &quot;false&quot; And rectemp2!YAPAST <> &quot;0&quot; Then
Call Add_Employee
End If
If strCheck = &quot;false&quot; And rectemp2!YAPAST = &quot;0&quot; Then
Call Add_Employee
End If
strCheck = &quot;false&quot;
Exit Sub
errorhandler:
Call PrintError
End Sub


Any suggestions?
 
On which line is the error occuring?

The only potential issue I see is no space between the table name and the 'where' key word in your SQL. Try

Code:
SQL = &quot;select * from [Employee Data Table]&quot; & _
        &quot; where [EMPID] = '&quot; & strEmpid & &quot;'&quot;


Take Care,

zemp

&quot;Show me someone with both feet on the ground and I will show you someone who can't put their pants on.&quot;
 
Zemp I tried adding a space did not work this is from which line it executes the Call PrintError routeen

If strEmpid > &quot;17000000&quot; And strCheck = &quot;false&quot; And rectemp2!YAPAST <> &quot;0&quot; Then
 
The greater than operator may be looking for a numerical value to evaluate. If strEmpid is always a number (in string form) then try,

Code:
If val(strEmpid) > 17000000 And ...


Take Care,

zemp

&quot;Show me someone with both feet on the ground and I will show you someone who can't put their pants on.&quot;
 
It is probably becuase your string strEmpid is either empty or conatins some other non nmeric data
Just add a check using the isnumeric function before your if statement. Something like this should do the trick.

if IsNumeric(strEmpId) then
If strEmpid > &quot;17000000&quot; And strCheck = &quot;false&quot; And rectemp2!YAPAST <> &quot;0&quot; Then
Call Add_Employee
End If
End if

Dave
 
I made some changes and now i get the type 13 mismatch on this line any suggestions?

On Error GoTo errorhandler
gRSEmpData!EMPID = rectemp2!yaan8
hldName = rectemp2!YAALPH
gRSEmpData!Name = hldName
Select Case rectemp2!YAPAST - THIS LINE IT BOMBS
Case &quot;D&quot;
gRSEmpData!status = &quot;S&quot;
Case &quot;0&quot;
gRSEmpData!status = &quot;A&quot;
Case &quot;S&quot;
gRSEmpData!status = &quot;O&quot;
Case Else
gRSEmpData!status = rectemp2!YAPAST
End Select
 
It might be that rectemp2!YAPAST is a NULL value, to get around this just add & &quot;&quot; to the end of your line .

i.e. Select Case rectemp2!YAPAST & &quot;&quot;
try that
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top