i have a table called Members which contain records of all customer.
in a form i fetch records from Members according to user input by Adodc1
then when i click on save button records are saved in different table called FD by Adodc2
if records are not found in Ist table than system gives a message record's are not found
But my probelm is that when again i type a Number( whihc is no in data base)
then my form does'nt show the this message it gave the error " run time error-13 (type mismatch" Note user enter the Customer no. (it is primary key also in Ist table)


My source code is that

Dim M As Integer
M = CInt(Text1.Text) 'user enter the MEMBER_NO WHICH IS INTEGER TYPE
Command8.Enabled = True

Adodc2.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BCS1;Data Source=DEEPAK-788C85F9"
Adodc2.RecordSource = "select * from Member_list where MS_NO='" & M & "'"

Set Text1.DataSource = Adodc2
Text1.DataField = "MS_NO"
Set Text3.DataSource = Adodc2
Text3.DataField = "M_Name"
Set Text4.DataSource = Adodc2
Text4.DataField = "F_Name"

Set Text13.DataSource = Adodc2
Text13.DataField = "Address"
MADD = Text13.Text
Adodc2.Refresh
Command8.Enabled = False
If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "Record are not found in Database FD can obtained from Society Member's only "
a = a - 1
Command8.Enabled = False
M = 0
Adodc2.Refresh

End If

Deepak, first of all, I have noticed that you are using the default names for your controls. When designing a big application you are almost gaurenteed to run into confusion. Try and use your own name sets as in 'Text1' maybe to 'txtName', 'adodc2' to maybe 'adodcMembers' etc.

To answer your question -

If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "Record are not found in Database FD can obtained from Society Member's only "
a = a - 1
Command8.Enabled = False
M = 0
Adodc2.Refresh

End If

is the part where your error will occur. I did not see a declaration for a as in

Dim a as Integer

. It also seems that a will be used to move your recordset back 1 space, is this correct? If so, it will generated an error because the BOF value is true, there is nothing to move back to...

Does this help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.