Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or data Member not found error on save - why??

Status
Not open for further replies.

jofarrell

Programmer
Mar 21, 2001
178
US
I am getting this weird error where it wont recognize .edit as a method of my recordset which I have defined above.

Any suggestions on what may be the problem .. the .addnew no problem.


Joanne
 
.edit is not a recordset method.

Get the recordset, change the values and call .Update

Chaz
 
hmmm ... I had always used .addnew and .edit before in my save functions with .update at the end with no problems.

Any other ideas?

For example :
Dim MyVendorEdit As Recordset

If IsNumeric(txtVendor.Text) Then
SQL = "SELECT * " _
& "FROM tblContact " _
& "WHERE tblContact.[ContactId] = " & txtVendor.Text
Set MyVendorEdit = DbsNew.OpenRecordset(SQL, dbOpenDynaset)

If Not MyVendorEdit.EOF Then
With MyVendorEdit
.Edit
If Trim(txtFirstName.Text) <> &quot;&quot; Then
!FirstName = txtFirstName.Text
Else
!FirstName = Null
End If
If Trim(txtLastName.Text) <> &quot;&quot; Then
!LastName = txtLastName.Text
Else
!LastName = Null
End If
.Update
.Close
End With
End If
end if
 
erm - ok, I may be wrong here - unfortunately, I'm at home at the moment, and can't make VB work under Linux ;-)

Sorry if I've misled you.

Chaz
 
No problem :)

Just an annoying problem of why it works in other programs and not this one. I have all my references made the same as other projects where I use this so I am at a loss.


Joanne

(who wishes she was home)
 
Anyone else have any suggestions as now it won't even read the SQL statement and gives : error 13 type mismatch on a simple function?
ContactID is an autonumber

Public Function chkValidNum(Num As Long) As Boolean
Dim rsCheckNum As Recordset
Dim Checker As Boolean

SQL = &quot;SELECT ContactID &quot; _
& &quot;FROM tblContact &quot; _
& &quot;WHERE tblContact.[ContactId] = &quot; & Num
Set rsCheckNum = DbsNew.OpenRecordset(SQL, dbOpenDynaset)

If Not rsCheckNum.EOF Then
Checker = True
Else
Checker = False
End If
rsCheckNum.Close
Set rsCheckNum = Nothing
chkValidNum = Checker
End Function

Any help is greatly appreciated!

*getting frustrated*

Joanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top