Hello to all i have following code:
Code:If txtName.Text = vbNullString Then MsgBox "You must fill the name box!", vbExclamation, "Warning" Exit Sub End If If txtName.Text = vbNullString Then MsgBox "You must fill the Name text box!", vbExclamation, "Warning" Exit Sub Else Dim db As Database Dim rs As Recordset Dim WS As Workspace Dim Max As Long Set WS = DBEngine.Workspaces(0) DbFile = (App.Path & "\DBS\DBXY.mdb") PwdString = "ss" Set db = DBEngine.OpenDatabase(DbFile, False, False, ";PWD=" & PwdString) Set rs = db.OpenRecordset("Items", dbOpenTable) If txtName.Text = rs.Index Then MsgBox "This contact already exists !", vbInformation, "Warning" Else rs.addNEW rs("name") = txtName.Text rs("price") = txtPrice.Text rs("kolichestvo") = txtKolichestvo.Text rs.Update Max = rs.RecordCount rs.MoveFirst frmMain.Combo1.Clear For i = 1 To Max Form1.Combo1.AddItem rs!FullName rs.MoveNext Next i Unload Me End If End If End Sub
and when i try to run it i got
Runtime error '13' Type mismach




Reply With Quote