SETFOCUS Object doesn't support this property or method (Error 438) (1 Viewer)

Kobus-Dippenaar

Registered User.
Local time
Today, 22:18
Joined
Oct 10, 2014
Messages
50
Hello once again to all out there!
The Libraries in Access is a pain, to many, but to all the gurus, please tel me why would I get this error? I am setting the field label, as in other programs.
Your help is appreciated, Blessings.

Object doesn't support this property or method (Error 438)
 

pr2-eugin

Super Moderator
Local time
Today, 20:18
Joined
Nov 30, 2011
Messages
8,494
Your question make little to no sense to me. Could you show the code you are dealing with or what exactly are you trying to do that causes this issue?
 

DavidAtWork

Registered User.
Local time
Today, 20:18
Joined
Oct 25, 2011
Messages
699
Kobus, sorry but you'll need to post the code ( or relevant snippet) that is failing, the error message you've posted could apply to many errors

David
 

Kobus-Dippenaar

Registered User.
Local time
Today, 22:18
Joined
Oct 10, 2014
Messages
50
My apologies, I add an attribute before update. The code adds individual fields and compares it to a check field. If out of balance it sets a message and the focus to one of the input fields, but the code does not direct the action to the input form. It closes and goes back to the main menu. The MsgBox is now temporary.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Wcnt As Double
Dim Wchk As Double
Wcnt = [COUNT 7&8] + [COUNT 9] + [L_COUNT 10] + [L_COUNT 12] + [L-COUNT 14] + [L_COUNT 16] + [Count 6] + [COUNT 7]
Wchk = [L_KG'S] - ([L_LOCAL] + [L_FOE] + [L_BACK])
If Wcnt <> Wchk Then Me.txtmsg = "Out Of Balance"
If Wcnt <> Wchk Then Me.txtmsg.SetFocus
If Wcnt <> Wchk Then MsgBox ("Input data out of Balance")

End Sub
 

DavidAtWork

Registered User.
Local time
Today, 20:18
Joined
Oct 25, 2011
Messages
699
so on which line does the code fail
Also are [COUNT 7&8] + [COUNT 9] + [L_COUNT 10] ... etc are these fields on the form because should be referenced as
Me.[COUNT 7&8] + Me.[COUNT 9] + Me.[L_COUNT 10] .. etc

Finally your line
PHP:
If Wcnt <> Wchk Then
    Me.txtmsg = "Out Of Balance"
    MsgBox ("Input data out of Balance")
    Me.txtmsg.SetFocus
End If

David
 

spikepl

Eledittingent Beliped
Local time
Today, 21:18
Joined
Nov 3, 2010
Messages
6,142
Apart from all the other comments, your criterion

If Wcnt <> Wchk Then Me.txtmsg = "Out Of Balance"


will almost never fail. Double (and single) numbers arenot reresented exactly, so you''l always have numerical fluff on last decimals. To decide whether or not two Double (or Single) numbers are "equal" the proper criterion is

Abs(FirstNumber-SecondNumber)< eps' where eps is a very small number you set yourself.

Alternatively, you can avoid this issue by using data type Currency, which is exact to 4 decimals.
 

DavidAtWork

Registered User.
Local time
Today, 20:18
Joined
Oct 25, 2011
Messages
699
one other aspect, if Me.txtmsg is a label, then you need to set the caption property
Me.txtmsg.Caption = "Out Of Balance"

David
 

Users who are viewing this thread

Top Bottom