0
votes

I am working on forms and made a single form for data entry and search ( data extraction) but the problem is that i used Dlookup formula on some textboxes for ease in data entry but when i attemp to search access doesn't show data on that textbox and shows the error that the object is read only. How can i get the textbox show data as well as have Dlookup formula? Kindly help. Many thanx

1
why don't you just change it to a combo ? - Patrick Honorez

1 Answers

0
votes

You can set the textbox value by code instead of putting the DLookup into the data source of the textbox.

Putting it into the data source means that you can't edit the textbox at runtime, as you experienced.
But you can set the value once in the Form_Open event, for example:

Private Sub Form_Open(Cancel As Integer)

    Me.TheTextBox = DLookup(...)

End Sub

This will cause the textbox to be filled automatically when the form opens, but the textbox is editable and you can overwrite the value.