requery cbo and make value equal to cur frm value

  • Thread starter Thread starter Angi
  • Start date Start date
A

Angi

This is easy...I think. I dbl click on my cboSize and it opens the
size form. I enter the dimensions and then requery the cbo when
closed. All that works fine but I want the cbo to be equal to the new
dimensions entered rather than having to pull down and select it.

Size form close event:

Private Sub Form_Close()
Forms!zproducts!cboSize.Requery
Forms!zproducts!cboSize = Me.txtSize
End Sub

txtSize is the concatenation of all dimensions.

tia
 
The Close event is too late, because the data is already unloaded.

You could try the form's Unload event.
 
Allen,
Ok, I moved it to the Unload event but now I'm getting

The value you entered isn't valid for this field.

I don't understand since it's in the cbo box and I can select it.
 
The message suggests that you are trying to assign the wrong kind of data to
the combo.

Is the combo bound to a Number type column, and you are assigning a piece of
text? Typically this happens if the bound column is zero-width. You could
open the form in design view, right-click the combo and choose Properties,
and examine these properties:
Bound Column (Data tab)
Column Count (Format tab)
Column Width (Format tab)
 
Allen,
You raised a good point and I see what's wrong and I don't know how to
fix it. The bound column IS zero width, but I don't want that seen, so
how I would avoid that?

My code is now this:

Forms!zproducts!cboSize.Requery
Dim SID As Integer
SID = Me.SizeID
Forms!zproducts!cboSize.Column(0) = SID

The new error is:
Property let procedure not defined and property get procedure did not
return an object.
 
Good. That's progress.

You are assigning the Value of the combo, so for the last ling, just use:
Forms!zproducts!cboSize = SID
which is equivalent to:
Forms!zproducts!cboSize.Value = SID
 
Back
Top