|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am trying to write the code for record updating, the following msg pop up:
Method or data member not found. Here is my coding: Set rst = New adodb.Recordset rst.Open "Member", db, adOpenDynamic, adLockOptimistic rst.Edit rst("ID") = txtLecID.Text rst("Name") = txtLecName.Text rst("Address") = txtLecAdd.Text rst("CIty") = txtCity.Text rst("PostCode") = txtPCode.Text rst("State") = cboState.Text rst("Tel") = txtLecTel.Text rst("Room") = txtRoom.Text rst("Email") = txtEmail.Text rst.Update MsgBox "Data Updated!", vbExclamation, "Inform" Why the rst.edit is debuging? .edit is not a invalid function?? ![]() |
|
#2
|
||||
|
||||
|
just remove the rst.Edit line...it isn't valid.
|
|
#3
|
|||
|
|||
|
if i remove the rst.edit, then a msg pop up saying that this consist of error because it will generate duplicate data.
Note that: ID is set to be the primary key. what is the solution for that??? hope advise ...thanks. |
|
#4
|
|||
|
|||
|
If ID is an autonumber don't try to edit it from code.
If ID is not an autonumber you have to do some coding to prevent trying to use duplicate values.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#5
|
|||
|
|||
|
ID is set to be the primary key in the database. i have created a form that allow user to do registration. In some cases, user may need to change thier personal information. so there is a edit button. But the coding cannot work.
I need help from u all... thanks |
|
#6
|
|||
|
|||
|
There is no need to use .edit coz normallly ado are in edit mode. just enable the fields and make changes to what eva u want, but while update use SQL update statement instate of updating ADO. Hope dis helps u
|
|
#7
|
|||
|
|||
|
Code:
Private Sub modify()
ErrorFlag = True
Call ErrorTrapper
Set rs = db.OpenRecordset("Select * from University_Master where U_Code = '" & lblCode.Caption & "'")
If ErrorFlag = True Then
lblName.ForeColor = vbBlack
rs.edit
rs("U_Name") = txtName.Text
rs("U_Address_1") = txtAdd1.Text
rs("U_Address_2") = txtAdd2.Text
rs("U_Address_3") = txtAdd3.Text
rs("U_Address_4") = txtAdd4.Text
rs("U_District") = txtDistrict.Text
rs("U_Country") = txtCountry.Text
rs("U_State") = txtState.Text
rs("U_Pin") = txtPin.Text
If txtWeb.Text = Empty Then
rs("U_WebSite_Name") = "Not Available"
Else
rs("U_WebSite_Name") = txtWeb.Text
End If
If txtMail.Text = Empty Then
rs("U_Email_Address") = "Not Available"
Else
rs("U_Email_Address") = txtMail.Text
rs("U_Phone") = txtNumber.Text
End If
If txtHistory.Text = Empty Then
rs("U_Brief_Story") = "Not Available"
Else
rs("U_Brief_Story") = txtHistory.Text
End If
If cmbISO.Text = "Certified" Then
rs("U_Is_ISO") = "True"
Else
If cmbISO.Text = "Not Certified" Then
rs("U_Is_ISO") = "False"
End If
End If
rs.Update
lblIns.Caption = "Record successfully modified."
statusBar.Panels(4).Text = "Data saved."
saved = True
Set rs = db.OpenRecordset("University_Master", dbOpenDynaset)
Call List
Else
Call StatusError
End If
End Sub
this is my vb code for Ms.Access, how to convert the code for SQL. I also remove the .edit but after the next line also is debugging, why? |
|
#8
|
|||
|
|||
|
You appear to be using DAO code, and I don't think SQL Server is supported by DAO (I don't really know, imho DAO should be avoided).
Try using ado code. ADO recordsets have no .edit method. |
|
#9
|
|||
|
|||
|
Thanks for replied, I appreciate it.
Can you compare wat's diff btw DAO and ADO code? how to change my DAO code to ADO code? or u have any recommended tutorials website? |
|
#10
|
|||
|
|||
|
Run-time error '3705':
Operation is not allowed when the object is open What should I do? HELP |
|
#11
|
|||
|
|||
|
Quote:
I don't know, maybe let someone know what code causes your error rather than hoping there are telepaths hanging around here. |
|
#12
|
|||
|
|||
|
Quote:
close all database or MS Acess and try to execute it again. the program being interrupting if ur database is open. Hope it help! |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > .edit is invalid in ado connection?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|