Run Time '13' error Type mismatch Why?? why??

iamraja5

Registered User.
Local time
Today, 01:15
Joined
Jun 2, 2006
Messages
11
Hi all
I have a simple forms with couple of text boxes, and one commad button and it has the following code : my tabe name is Customer Data
it seems that access doesnt like the line :
Set cusdata = CurrentDb.OpenRecordset("Customer Data")

Private Sub Command12_Click()
Dim cusdata As Recordset
Set cusdata = CurrentDb.OpenRecordset("Customer Data")
cusdata.AddNew
cusdata.Fields("Customer_Last_Name") = Me.custfirstname
cusdata.Fields("Customer_First_Name") = Me.custfirstname
cusdata.Fields("Cus_Address_1") = Me.cusadd1
cusdata.Fields("Cus_Address_2") = Me.cusadd2
cusdata.Fields("Cus_STATUS") = Me.cusstatus
cusdata.Update
MsgBox " Record saved"

End Sub


when I press the command button to save the record ( after filling the text bxes with customer inforamtion). I am getting the above error msg. Run rime error 13 , type mismatch , error indicating there is an issue with the command
Set cusdata = CurrentDb.OpenRecordset("Customer Data")

any help will be much appriciated.
Thanks
 
Hi when entered as
Dim cusdata as Dao.Recordset
I got an error as user-defined type not defined.
thanks
 
The MS DAO reference needs to be added in Tools/References.
 
the DAO reference needs to be above the ADO reference, if you have that set in the references
 
The order of references is irrelevant, if the code is disambiguated as suggested by Keith and posted by the OP.
 
Thanks , it worked after I setup the DAO, in the tools->reference.

Appriciated all your help.
 

Users who are viewing this thread

Back
Top Bottom