Control cannot be edited it's bound to autonumber field

diasflac

Registered User.
Local time
Today, 16:05
Joined
May 13, 2013
Messages
45
Not sure why this is happening, I have written a code to look up by the unique reference number rather than use the wizard to avoid this error happening... The field is restricted to list only so you can't actually edit the number.

For ease of use you cannot scroll by record and I need to filter by the ID. Is there an easy fix to this combobox?

Would creating a seperate query work?

Is there another lookup code I could use where I don't need to have the combo box bound to the ID field since it's not being edited anyway? I had a go at one and although it would now let me select it wasn't updating the record, tried a few ways but it seems that it needs to be bound to the field.
 
Showing us the code might be enlightening.
 
Showing us the code might be enlightening.

This is the 3rd one I've tried, didn't save the other 2. Same results either way.


Private Sub cmbFind_AfterUpdate()
If IsNull(Me!cmbFind) Then Exit Sub

With Me.RecordsetClone
.FindFirst "[RFQ Reference] = " & Me!cmbFind
If Not .NoMatch Then
If Me.Dirty Then Me.Dirty = False
Me.Bookmark = .Bookmark
Else
DoCmd.GotoRecord , , 1
End If
End With
End Sub
 
Last edited:
Your code is fine. The problem is the combo setup. It is bound to the RecordSource field so it tries to update the value when you select a new value.

Delete the ControlSource property from the combo.
 
Actually, you need to create a separate unbound control to use for searching. Leave the bound control as it was.
 
Your code is fine. The problem is the combo setup. It is bound to the RecordSource field so it tries to update the value when you select a new value.

Delete the ControlSource property from the combo.

Removing the control source worked, there seemed to be an issue with CmbFind as it's used in another open form, just renamed the combo box and everything worked fine. Thank you.
 

Users who are viewing this thread

Back
Top Bottom