change a form from edit to read-only after entering data in a combo box

I have created a form that is read-only with loaded/opened. I have created a combo box that allows the user to select a record in the master database and then fills in the form.

I have been successful in getting the combo box to allow entry with allowedits=true in KEYPRESS, the form is filled in, but once I hit enter even though I have put allowedits=false in ON CLICK, ON ENTER.

Can this be done ? Have I forgotten something ?

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

stevbeConnect With a Mentor Commented:
Private Sub Text1_AfterUpdate()
    Me.Recordset.FindFirst "[SSN]=" & "'" & Me![Text1] & "'"
    Me.AllowEdits = False
End Sub
use the AfterUpdate event of the combobox.
one way I have done this in the past is to put the "Find" combobox in a seperate subform that is not bound and has AllowEdits= true and leave the main form AllowEdits = False. You only need to adjust your FindFirst code to reference me.Parent...

If you want to go this way please post your code and we can fix it up :-)


proffittwareAuthor Commented:
Yes, I did the subform initially and it worked they way I wanted.

I was just trying to do a one screen "Find/Search", then data entry or read-only. I have buttons ADD, EDIT, SAVE that change the read-only/data entry back and forth. But the "FIND" combo box is a problem. Do you think this can be done?

proffittwareAuthor Commented:
I tried adding to my AfterUpdate:


In my AfterUpdate event I put the above statment - after the Private statement- tested and then before the End Sub- tested and they both did not work.

I had tried this before asking for help, maybe my AfterUpdate event has a problem?

Private Sub Text1_AfterUpdate()
Me.RecordsetClone.FindFirst "[SSN]=" & "'" & Me![Text1] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
proffittwareAuthor Commented:
Sorry I did not get back with you sooner...had Internet issues.

Thanks for your input !!!
All Courses

From novice to tech pro — start learning today.