Help locking a combobox after selection but enabling it on a new record (1 Viewer)

g3machining

New member
Local time
Today, 16:35
Joined
Nov 16, 2016
Messages
4
Hello everyone,

I am refreshing my knowledge in Access and need some help with this one.

I am using Access 2013.

I am using a combobox to populate customer information that is drawn from a table.

My problem is I want to be able to select the proper customer and once the record is saved not be able to edit the selection.

If I put in code to lock down the selection after it loses focus, then on the next record I am unable to make a selection because it is locked.

This form is to be used to store customer quotations. I don't want any users to go back and accidentally change the customer information.

I do want to be able to edit other information in the quote since jobs do change.

Perhaps I am going about it all wrong.

Any help would be appreciated.

Thanks in advance!

Brandon
 

Ranman256

Well-known member
Local time
Today, 17:35
Joined
Apr 9, 2015
Messages
4,339
if there is no index, enable the combo, if it has one, turn it off.

Code:
sub Form_OnCurrent()
  cboBox.enabled = IsNull(me.ID)
end sub
 

g3machining

New member
Local time
Today, 16:35
Joined
Nov 16, 2016
Messages
4
I entered the code, but I am having an issue.

It is carrying over the previous selection onto the new record.

This makes the code obsolete.

Not sure how to clear the selection on new records.
 

Users who are viewing this thread

Top Bottom