Solved

Access 2007 vba function runtime error 438.  Object does not support this property or method

Posted on 2010-08-31
4
1,374 Views
Last Modified: 2013-11-28
In the attached code, I making sure the user has entered data in each box.  The function is called from a save and exit function.  It all works except the section for Operator.   If the Operator box is empty, the message box is displayed as planned.  But then it crashes with the error message.

Microsoft Visual Basic
Runtime Error  '438'
Object does not support this property or method

When I select Debug it points to the line of code:
Me!Operator.SetFocus

Operator is the correct control source.

What am I looking for?
Thanks,
Brooks
Private Function CheckDataBeforeSaveAndExit() As Boolean
    If Me.Etch_Lot = "Select Etch Lot" Or IsNull(Me.Etch_Lot) Then
            MsgBox "Please select an etch lot number from the list."
            CheckDataBeforeSaveAndExit = False
            Me!Etch_Lot.SetFocus
    ElseIf IsNull(Me.Start_Qty) Then
            MsgBox "Please enter Start Quantity."
            CheckDataBeforeSaveAndExit = False
            Me!Start_Qty.SetFocus
    ElseIf IsNull(Me.End_Qty) Then
            MsgBox "Please enter End Quantity."
            CheckDataBeforeSaveAndExit = False
            Me!End_Qty.SetFocus
    ElseIf IsNull(Me.Furnace) Then
            MsgBox "Please select a furnace."
            Me!Frame39.SetFocus
            CheckDataBeforeSaveAndExit = False
    ElseIf IsNull(Me.Operator) Then
            MsgBox "Please select operator."
            Me!Operator.SetFocus
            CheckDataBeforeSaveAndExit = False
    Else
            CheckDataBeforeSaveAndExit = True
    End If

Open in new window

0
Comment
Question by:gbnorton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 300 total points
ID: 33570868
This is probably due to you keeping the default Control Names..
Please change the control names to follow a standard naming convention: (http://www.xoc.net/standards/default.asp)

The issue with leaving the default names is that the Control name is the same as the filed name.
While a control will have a .SETFOCUs property, a Filed will not.
(resulting in your error)

Note after changing all the control names:
Save the Form/Report.
Change the code to reflect the new names
Compile the code (In the VBA Editor click: Debug-->Compile)
The run the Compact/Repair utility, then retest..

;-)

JeffCoachman
0
 
LVL 14

Assisted Solution

by:pteranodon72
pteranodon72 earned 200 total points
ID: 33570885
It looks like some of the controls on your form have the same name as their bound field (like Etch_Lot) and others are not named like the bound field (Frame39 is bound to field Furnace, it appears.)

If there is no Control on the form named Operator,  Me!Operator resolves to the Operator *Field*, which cannot have events attached.

Operator sounds like a reserved word, so I would rename the control to fraOperator or cboOperator, etc. in the Properties->Other tab. Keep the Control Source as Operator (as shown in the Data tab). Then use Me!Operator to refer to the value of the field and Me!cboOperator.SetFocus to refer to the control.

HTH,
pT72
0
 

Author Closing Comment

by:gbnorton
ID: 33571291
I don't know if who's the quickest matters.  You both gave excellent responses.  Jeff was a little quicker...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33572556
I have no problem with the split.

pteranodon72 gave an explanation for another technical viewpoint, which is always helpful.

;-)

JeffCoachman
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Database 5 47
IIF syntax in MS Access 1 63
Sharepoint list to Access database 9 51
Access query error 3 26
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question