Share via

Query re: OLEObject

Maxine Nietz 1 Reputation point
2025-02-20T17:49:12.4366667+00:00

I have two tables with OLE Object fields: SCHEDULE has a field named ColorTextBox. ColorsTable has a field named Color. The form ScheduleFormCont, based on the SCHEDULE table, has a Bound Object Frame control named ColorTextBox that displays the color from the SCHEDULE table.

I have the following code on a button of a form:

DoCmd.SetWarnings False

DoCmd.RunSQL "UPDATE SCHEDULE INNER JOIN ColorsTable ON SCHEDULE.ColorText = ColorsTable.ColorName SET SCHEDULE.ColorTextBox = [ColorsTable]![Color] WHERE SCHEDULE.SONo = [Forms]![ScheduleFormCont]![SONo];"

DoCmd.SetWarnings True

 [Forms]![ScheduleFormCont]![ColorTextBox].OLETypeAllowed = acOLELinked

[Forms]![ScheduleFormCont]![ColorTextBox].Class = "Paint.Document"

[Forms]![ScheduleFormCont]![ColorTextBox].SourceDoc = "C:\Users\nevadamax\OneDrive\Documents\USWelding\" & Forms!ScheduleFormCont!ColorText & ".bmp"

[Forms]![ScheduleFormCont]![ColorTextBox].Action = acOLECreateLink

[Forms]![ScheduleFormCont].Requery

DoCmd.Close acForm, "AddColorForm"

The problems are:

  1. I get a Write Conflict error. Even if I select Save Record, it does not.
  2. When I look at the ColorTextBox field in the SCHEDULE table, it shows "OLE Object." All the previous ones show "Bitmap Image" and display the color on the form.

Please help!?!?!?

Microsoft 365 and Office | Development | Microsoft 365 Developer Program
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.