Type Mismatch

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
 
D

Douglas J Steele

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.
 
S

Seeker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Type Mismatch 2
User Defined 3
Type Mismatch 3
Object dosent support this property or method 2
User Defined Type 2
If Statements 4
Data Entry = No 6
Type Mismatch 2

Top