Type Mismatch

  • Thread starter Thread starter Seeker
  • Start date Start date
S

Seeker

I'm going blind trying to find the "type Mismatch" in this code - could
someone please help??
If IsNull([PVNO]) Then
MsgBox "Please enter the Provider Number # before proceeding."
Exit Sub
Else
'Check to see if a record already exists
Set dbcurrent = CurrentDb
Set rstemp = CurrentDb.OpenRecordset("select * from [t_Prov] where
[PV_NUMBER] = " & "'" & Me.[PVNO] & "'" & ";")

stDocName = "f_Prov"

If rstemp.RecordCount > 0 Then 'Open Record
stLinkCriteria = "[PV_NUMBER]=" & "'" & Me.[PVNO] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else 'Create a new record
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!f_Prov.DataEntry = True
End If
Forms!f_Prov.PV_Number = Me.PVNO
End If
 
How did you declare rstemp (and what version of Access are you using?)

Odds are you have references set to both ADO and DAO, and you only declared
Set rstemp As Recordset, which would result it in being declared as an ADODB
recordset, rather than the DAO recordset your code needs.

Try

Dim rstemp As DAO.Recordset

If that's not the problem, let us know the line on which it's failing.
 
Your good, I hope you get paid what your worth!!!!

DAO in my DIM worked....

Thanks

How did you declare rstemp (and what version of Access are you using?)

Odds are you have references set to both ADO and DAO, and you only declared
Set rstemp As Recordset, which would result it in being declared as an ADODB
recordset, rather than the DAO recordset your code needs.

Try

Dim rstemp As DAO.Recordset

If that's not the problem, let us know the line on which it's failing.
I'm going blind trying to find the "type Mismatch" in this code - could
someone please help??
[quoted text clipped - 18 lines]
Forms!f_Prov.PV_Number = Me.PVNO
End If
 
Back
Top