Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Type Mismatch ?????
Message
 
À
27/08/2001 11:06:55
Information générale
Forum:
Microsoft Office
Catégorie:
Access
Divers
Thread ID:
00549451
Message ID:
00549469
Vues:
15
This message has been marked as a message which has helped to the initial question of the thread.
Hi Michael,

Are you sure that field CATALOG is a string datatype? If it is NUMERIC it would give you an error.
Personally I prefer code like this:
Private Sub Command32_Click()

Dim R As DAO.Recordset
Dim SQLText as String

SQLText = "Select * From Product Where Catalog = 'CAT3';"
Set R = CurrentDb.OpenRecordset(SQLText,dbOpenDynaset) ' consider dbOpenSnapshot
If not R.BOF() Then
    MsgBox "Record exists"
Else
    MsgBox "Record not found"
End If
R.Close
Set R=Nothing

End Sub
>The following line in the code below generates a Data Type Mismatch Error any ideas why? I took the code straight out of a MSAccess book.
>
>Set R = CurrentDb.OpenRecordset(SQLText)
>
>
>
>
Private Sub Command32_Click()
>
>cDim R As Recordset, SQLText
>SQLText = "Select * From Product Where Catalog = 'CAT3'"
>Set R = CurrentDb.OpenRecordset(SQLText)
>If R.RecordCount Then
>
>    MsgBox "Record exists"
>Else
>    MsgBox "Record not found"
>End If
>
>End Sub
Igor Gelin
Database Developer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform