Compile time error:Method or data member not found (1 Viewer)

Amandeep singh

New member
Local time
Today, 04:50
Joined
Apr 6, 2020
Messages
1
Hi everyone, I have a single Compile time error:Method or data member not found in my code. Can You guys solve or suggest me how to remove that error.


Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/

Code:
Option Compare Database
Option Explicit


Private Sub cboGoToEmployee_AfterUpdate()

    ' find matching row in form's recordset's clone
    ' and synchronize bookmarks if found
    With Me.RecordsetClone
        .FindFirst "EmployeeID = " & Nz(Me.cboGoToEmployee, 0)
        If Not .NoMatch Then
            Me.Bookmark = .Bookmark
        End If
    End With

End Sub


Private Sub Form_Close()

    On Error Resume Next
    Forms("frmOpen").Visible = True

End Sub

Private Sub Form_Current()

    ' synchronize go to employee combo box
    ' with current record
Me.cboGoToEmployee = Me.EmployeeID
   
End Sub

I attached my program have a look. Please suggest or solve this problem.
 

Attachments

  • abc.zip
    142 bytes · Views: 101
Last edited by a moderator:

June7

AWF VIP
Local time
Today, 02:50
Joined
Mar 9, 2014
Messages
5,423
There is no db file in that zip folder. There is a folder with nothing in it.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:50
Joined
May 21, 2018
Messages
8,463
If frmOpen is not open (hidden) you get a run time error here
Forms("frmOpen").Visible = True

If your field is not called EmployeeID you get a compile time error here
Me.cboGoToEmployee = Me.EmployeeID
 

strive4peace

AWF VIP
Local time
Today, 05:50
Joined
Apr 3, 2020
Messages
1,003
hi Amandeep,

Welcome!

before you move to another record, you should save the one you're on if its "dirty" (has unsaved changes)
Code:
if me.dirty=true then me.dirty=false

Better than synchronizing a Find combo with the current record would be to clear it. And instead of going anywhere, if there is no value, just exit

Rich (BB code):
dim nEmployeeID as long 'assuming this is the data type

with Me.cboGoToEmployee
   if isNull(.value) then exit sub
   nEmployeeID = .value
   .value = null
end with

then, after saving the current record if needed:
Code:
.FindFirst "EmployeeID = " & nEmployeeID

Since the Find combo is cleared after it is read, you should delete the Form_Current event.

> "Method or data member not found "

as Gasman, stated, the compiler shows you the (first) line that has a problem ... what gets highlighted?
A name is being used that isn't right.
 
Last edited:

Users who are viewing this thread

Top Bottom