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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 461 Method or Data member not found 1

Status
Not open for further replies.

Murphette

Technical User
Jun 17, 2005
10
US
I am working on a form where schedulers can pre-register staff into upcoming classes. I keep coming up with the error message 461 with the code I have so far. What am I missing?

Private Sub Add1030()
'Code to add a record to T-Class Attendance if the scheduler chooses the 10:30AM class.
'New record must contain a StaffID, an EventID and an attendance status of false for pre-registered status.


Dim db As Database
Dim Rec As DAO.Recordset
Set db = CurrentDb()
Set Rec = db.OpenRecordset("T-Class Attendance", dbOpenDynaset)

Rec.AddNew
Rec.StaffID = Me!cmbStaff
Rec.EventID = Me!txtthis1030Event
Rec.Attended = False
Rec.Update
Rec.Close
End Sub
 
Generally, dot (.) when referring to a method of the recordset (like AddNew), bang (!) when referring to a field in it:

Rec.AddNew
Rec!StaffID = Me.cmbStaff

Paul
MS Access MVP 2007/2008
 
Does your combo have more than one column ?

If so, is the default/bound field the same type as the underlying table you're trying to write to ?

Is the .Attended field boolean ?

Tyrone Lumley
SoCalAccessPro
 
I think pbaldy is correct. A recordset has a fields collection which is the default, but unlike a form the fields are not individual properties as well.

so
Rec!StaffID = Me!cmbStaff
or
Rec.fields("StaffID") = Me!cmbStaff
but not
Rec.StaffID

on a form
Me.cmbStaff
Me!cmbStaff

both work because cmbStaff is both a member of the controls collection and an individual property.
 

I agree with Paul.

All the fields of the recordset need bangs, not dots.
 
pbaldy, You're the best...you saved me. Thanks a bunch. And SoCalAccessPro, my bound column in the combo was ok, and yes, the attended field is boolean. I was able to successfully add a record using the bang. I appreciate all the help.
 
I have the following piece of code in my program i am getting the Error message:" Compile Error:Mehtod or data variable not found."

Private Sub Review_Click()
Dim strFilter As String

txtRig.Enabled = True
txtWellNo.Enabled = False
txtPermit.Enabled = False
txtPad.Enabled = False
txtDtStart.Enabled = True
txtDtEnd.Enabled = True
txtInspect.Enabled = True

If Not IsNull(txtInspect) And txtInspect <> "" Then
' strFilter = "InspectNo = '" & txtInspect & "'"
If Right(txtInspect, 1) = "*" Then
strFilter = "InspectNo like '" & txtInspect & "'"
Else
strFilter = "InspectNo='" & txtInspect & "'"
End If
End If

If Not IsNull(txtRig) And txtRig <> "" Then
If Len(strFilter) > 0 Then
strFilter = strFilter & "AND RigKey = '" & txtRig & "'"
Else
strFilter = "RigKey = '" & txtRig & "'"
End If
End If

If Not IsNull(txtDtStart) Or Not IsNull(txtDtEnd) Then
If Not IsNull(txtDtStart) Then
If Len(strFilter) > 0 Then
strFilter = strFilter & " AND InspectDt >= #" & txtDtStart & "#"
Else
strFilter = "InspectDt >= #" & txtDtStart & "#"
End If
End If

If Not IsNull(txtDtEnd) Then
If Len(strFilter) > 0 Then
strFilter = strFilter & " AND InspectDt <= #" & txtDtEnd & "#"
Else
strFilter = "InspectDt <= #" & txtDtEnd & "#"
End If
End If
End If

If Len(strFilter) > 0 Then

* i get the error on the following line.where it says it cant find the form frmFASDIV and also i noticed i dont get the frmFASDIV selected from the ME.() drop down selection list as its not shown in the list .What am i missing here?*


Me.frmFASDIV.Form.Filter = strFilter
Me.frmFASDIV.Form.FilterOn = True


Else

Me.frmFASDIV.Form.FilterOn = False



End If


End Sub


any help will be highly appreciated.
 
Is frmFASDIV the name of a subform control on the form? Not the name of the subform, but the name of the control itself, which could be different.

Paul
MS Access MVP 2007/2008
 
Whoops, I was too slow. Glad you got it sorted out.

Paul
MS Access MVP 2007/2008
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top