Frozen Combo Box

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Frozen Combo Box

Post by Leesha »

Hi,

I have a form that is bound to a query that is not set to totals. The form allows additions, but does not allow edits. There is an unbound combo box that contains a list of answers for the user to pick from. On the after update event, a second form is opened. Everything is working fine except that the combo box does not show any of the fileds from its row source. If I set the form to allow edits it works fine. Is there code that I can use on the has focus event that will make the unbound combo box show the row source data?

Thanks,
Leesha

User avatar
HansV
Administrator
Posts: 78555
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Frozen Combo Box

Post by HansV »

I see no reason why a combo box wouldn't show data when Allow Edits is set to No. (You won't be able to select a different item in existing records, of course, because you can't edit records). I'd have to see the database.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Frozen Combo Box

Post by Leesha »

Here you go. Click the "Edit Status" button. The combo box will be made visible, you can see the row source info, but can't choose anything.

Thanks,
Leesha
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78555
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Frozen Combo Box

Post by HansV »

Of course not - Allow Edits has been set to No, so you can't change anything, except when you're on a new record. This is true even for an unbound control.

If you want the user to be able to select a value in an existing record, you have to set the Allow Edits property of the form to Yes, by adding a line

Me.AllowEdits = True

to cmdEnable_Click().

Another option is to set Allow Edits (and Allow Deletions) to Yes, and to set the Recordset Type property to Snapshot. This also prevents editing of existing records, but the user can edit unbound controls.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Frozen Combo Box

Post by Leesha »

Thanks Hans. I had a feeling it was the allow edits setting but wasn't sure if that only applied to bound controls or not. I appreciate the help with the code. I've never used the snapshot property before and will need to take a look at that.

Thanks!
Leesha