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

Error 438 - Object does not support this property or method

Status
Not open for further replies.

Ally72

Programmer
Nov 12, 2001
31
GB
Hi. I've got a combo box which when you choose from the list, gives the message above.

I've made the default value Null, tried deleting the combo box and re-entering it, saving the record and have checked the relationships which appear to be fine.

Does anyone have any ideas please!?
 
Sorry - forgot to say, that once you click OK on the error message, it lets you move on.
 
I suspect you actually do have an issue.

A combo box can select multiple fields but only one field is bound to the form. The data type of the bound form must match any criteria for the combo box.

For example, record source is...[tt]
SELECT ContactID, LastName, FirstName FROM tblContacts[/tt]

The bound form is ContactID
The combo box is configured to display the LastName (by setting the column width to zero for the first field, ContactID).

...Works fine

Now someone tweaks the combo box to...[tt]
SELECT LastName, FirstName FROM tblContacts
ORDER BY LastName[/tt]

Seems okay, but the bound column was ContactID which was numeric and the new bound field (column 1 in this case) is a text string.

Richard
 
Hi - thank you for replying.

The combo box is configured to display the Doctor/Nurse Grade, with the ID hidden (column width zero).

SELECT tblDocNurseGrdMF.DocNurseGrdID, tblDocNurseGrdMF.DocNurseGrd
FROM tblDocNurseGrdMF;
DocNurseGrdID DocNurseGrd

tblDocNurseGrdMF is DocNurseGrdID = Autonumber and DocNurseGrd = Text
1 Anaesthetic Reg
2 Anaesthetic SHO
3 Bed Manager
4 Consultant Anaesthetist
5 COPD Team
... ...etc etc etc
 
And no line of code highlighted when you click the debug button instead of the OK one ?
You may have some coding problem in an event procedure.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks. I looked at the FAQ you mentioned and am sorry if I've come across in any way that's not correct!

There's no debug option, so no line of code highlighted. Unfortunately, the only option is OK, not even Help!

I've tried debugging but that didn't come up with anything.

There's only Me.Refresh on the AfterUpdate event of the combo and some OnCurrent. The combo is automatically disabled and remains so unless the field before = Doctor or Nurse, where there's code on this combo box to either enable or keep disabled the field in question.
 
Can you please post all the code of all the event procedures of the combo ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you.

ReferralID is the field before the doctor/nurse grade combo that is causing the error.

Private Sub ReferralID_AfterUpdate()
Select Case ReferralID
Case 1
PAROnRef.Enabled = False
PAROnRef.Value = -1
DocNurseGrdID.Enabled = False
fraPostITU.Enabled = True

Case 2
DocNurseGrdID.Enabled = True
PAROnRef.Enabled = True
fraPostITU.Enabled = False
PostITU.Value = 3

Case Else
DocNurseGrdID.Enabled = False
DocNurseGrdID.Value = Null
PAROnRef.Enabled = True
fraPostITU.Enabled = False
PostITU.Value = 3

End Select
End Sub


'Refresh doctor / nurse grade combo box
Private Sub DocNurseGrdID_AfterUpdate()
Me.Refresh
End Sub

Private Sub Form_Current()
'ON CURRENT EVENT

Me.DocNurseGrdID.Enabled = False


'Enable doctor / nurse grade if referral source is Doctor /
'Nurse and disable / enable PostITUHDU frame depending on
'value
Select Case ReferralID
Case 1
PAROnRef.Enabled = False
DocNurseGrdID.Enabled = False
fraPostITU.Enabled = True

Case 2
DocNurseGrdID.Enabled = True
PAROnRef.Enabled = True
fraPostITU.Enabled = False

Case Else
DocNurseGrdID.Enabled = False
PAROnRef.Enabled = True
fraPostITU.Enabled = False

End Select
End Sub

Private Sub Form_Open(Cancel As Integer)
Call fAllowEdits(Form)
Me.Refresh

DoCmd.Maximize
Me.Refresh
End Sub

Private Sub Form_Load()
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Requery
End Sub

Allow edits is a function to give certain users read-only or full access.

Public Sub fAllowEdits(frm As Form)

Dim ctl As Control, db As Database, r As Recordset
Dim Lev As Integer, intCanEdit As Integer, Nme As String, frmName As String

Set db = CurrentDb
Set r = db.OpenRecordset("tblUsers")

'msgbox "Current form is " & frm.Name


Call fOSUserName2
Nme = fOSUserName2

Do While Not r.EOF

If Nme = r.Fields("Username") Then
Lev = r.Fields("LevelID")
End If

r.MoveNext
Loop

If Lev = 2 Then
intCanEdit = False
Else
intCanEdit = True
End If

If intCanEdit = False Then
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With

For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acComboBox, acTextBox, acListBox, acSubform, acCheckBox, acOptionButton
ctl.Locked = True

Case acCommandButton
If ctl.Name = "cmdDelete" Or ctl.Name = "cmdAddNew" Or ctl.Name = "cmdAdd" Then
ctl.Enabled = False

End If
End Select
Next ctl

Else
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
End With

For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acComboBox, acTextBox, acListBox, acSubform, acCheckBox, acOptionButton
ctl.Enabled = True
ctl.Locked = False

If ctl.Name = "txtunitno" Or ctl.Name = "txtptname" Or ctl.Name = "txtptname2" Or _
ctl.Name = "txtptdob" Or ctl.Name = "txtdiagopid" Or ctl.Name = "txtstatus" Or _
ctl.Name = "txtCons" Or ctl.Name = "txtConsChange" Then
ctl.Enabled = False
ctl.Locked = True
End If

Case acCommandButton
ctl.Enabled = True

End Select
Next ctl
End If

End Sub

 
No event procedure for the combo or am i missing something ?
No control with same name as field ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ally

I've made the default value Null, tried deleting the combo box and re-entering it

Sometimes Access gets confused to really messed up, or no problem at all when you delete an object with code, and then re-create the object with the same name.

Okay, before getting our finger nails dirty, do you know what specific line is causing the error?

What is the name of the combo box in question? Should it be ReferralID where you select the referral?

Two possible issues:
- Is the code actually being run?
- Note in the code that it is looking for a numeric value.
Code:
   Select Case ReferralID
        Case 1
...
        Case 2

Two address the second issue, look at the record source for the combo box...
- The SQL statement will give you the columns used by Access to a) retrieve the data, b) controls how the data is presented...
Make sure the column sequence starting at 1, is the field associated with ReferralID.

- You can tell how the code works by placing a STOP statement in the code and use F8 to step through the code...
Code:
Private Sub ReferralID_AfterUpdate()
[COLOR=blue][b]STOP[/b][/color]
    Select Case ReferralID
        Case 1
            PAROnRef.Enabled = False
            PAROnRef.Value = -1
            DocNurseGrdID.Enabled = False
            fraPostITU.Enabled = True

Richard
 
Thank you both for replying.

PHV: No there's no event for the combo, just Me.Refresh.

I've just realized that it's not just this field. It's something on the form perhaps. I was entering some test data for something else, and entered Follow-up in the ReferralSourceID field. This means that the one that was causing the problem, DocNurseGrdID remains disabled. I then went and entered something else and everything was fine until I went to close the form, which is when I got the error.

I'm going to try the debugging again as mentioned and will post back if I find anything.
 
I've tried debugging with the STOP command and it doesn't flag up anything. It steps through the code and then stops at End Sub and bleeps.
 
I've tried debugging with the STOP command and it doesn't flag up anything. It steps through the code and then stops at End Sub and bleeps

Does this mean you no longer get ...
Error 438 - Object does not support this property or method ??

What are you doing that generates the error?
 
Hi,

Just an idea.....

Enter a valid record ID value as the default value.

Do you still get the same error?

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
Thank you and sorry for delay - the site was temporarily blocked at work.

Does this mean you no longer get ...
Error 438 - Object does not support this property or method ??

What are you doing that generates the error?
Yes - it does mean that the error doesn't occur in this mode.

There doesn't seem to be any pattern to the error - only that it happens on this field, (the DocNurse grade combo) or when you try to close, or when you effectively close, by going to design view.

Darrylles - I will try the default option tomorrow.
 
Having done a copy and adding heaps of records each time entering something different, I get the same error on any number of different fields, therefore, I'm not sure if it's worth trying the default option. It's very confusing!!! %-) On one particular field, I kept getting "You cannot add or change a record because a related record is required in table 'episode'"

I overcame these by adding a save command, but the error occurs here now, if it hasn't happened already in the previous combo. If I skip that part and go to another field it happens there - a label that you click to take you to another page - so not a field that stores a value.

If you're able / have time to carry on looking at this, would it help to try and mail / post a cut down version of it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top