Combo Box LimitToList Problem

stretch66

Racing towards the start
Local time
Today, 13:05
Joined
Sep 28, 2005
Messages
72
Hi,

I have a combo box that includes 2 columns one being a Autonumber and the other is Name. I want to be able to add a Name to the list but cannot set property of "LimitToList" to No. When I try it says that "The first visible column, which is determined by the ColumnWidths property, isn't equal to the bound column" I have adjusted the widths but still doesn't work?

Can anyone help please?
 
The first visible column, which is determined by the ColumnWidths property, isn't equal to the bound column"

This means that the name you type (which isn't in the database) cant be found, therefore the bound column (the hidden column) cant find a record with a matching auto number. This has nothing to do with column widths.

You need to add error handling to cope with records that are not in the list.

I will look for a demo in my collection.

Dave
 
Thanks Dave, I was trying something similar but when I went back to the original form it wasn't updating the list in the combo box but will try and implement yours.

Cheers
Adam:)
 
Cheers,

Look at the Isloaded function, that is used to check if a form is open and from there you can update the fields you like.

Dave
 
What will the IsLoaded function do? I am ordering stock for a person and so cannot save or close the current form so that I can add an employee, will it still update?
 
i've had this problem... the way i get around it is change the first column width to greater than zero, change the limittolist to yes, then when it accepts that, change the first column back to 0cm. ;-)
 
What will the IsLoaded function do? I am ordering stock for a person and so cannot save or close the current form so that I can add an employee, will it still update?

The Isloaded function is simply a function that looks to see if a form is open (or loaded). If it is, the you add code to save related records and refresh the combo box list.

Study the code in the Add Client form (the one that pops up when you press yes on the message box)

In the Unload event (one that triggers when the form closes)


Private Sub Form_Unload(Cancel As Integer)
On Error GoTo Err_Form_Unload
Dim i As Integer
Dim rs As Object

DoCmd.RunCommand acCmdSaveRecord Save the record
i = Me.ClientID Set a reference to the newly added data

If IsLoaded("frmNewSale") Then See if the form is open
Forms!frmNewsale!ClientID.Requery Refresh the data in the combo box (which gets its data from the clients table that you just added the new record to)
Forms!frmNewsale.ClientID = i Set the combo box to the new data
End If

Exit_Form_Unload:
Exit Sub

Err_Form_Unload:
If Err <> 2118 Then
MsgBox Err.Number & " - " & Err.Description, , " AEMS"
Resume Exit_Form_Unload
End If

End Sub
 
i've had this problem... the way i get around it is change the first column width to greater than zero, change the limittolist to yes, then when it accepts that, change the first column back to 0cm. ;-)

Seems a pretty amateurish way of doing things
 
well that fits because i AM an amateur! ;-) seems to work and i have found no other way of getting around the problem. seems to me a silly way for Microsoft developers to not allow "limit to list" based solely on a column length that can be changed to and fro to trigger acceptance of the property, but eh, works for me. how else could it be done!? i've never seen it been explained, my way or other.
 
Oldsoftboss,

you're not much of a softie, are you... if i was vulnerable you might have broken any confidence i had. what a way to get people to contribute to the forums! i though people like you would appreciate others helping out, and besides, i don't see your solution posted...?? (that is to say, i looked at the file you uploaded, and you had a column count of 2 and column widths of "0cm".... hardly looks more advanced to me and doesn't get aorund receiving the error originally posted.)
 
i've had this problem... the way i get around it is change the first column width to greater than zero, change the limittolist to yes, then when it accepts that, change the first column back to 0cm. ;-)

"Thank You...Thank You....Thank You. I have been trying for fix this for days and haven't been able." I have used this forumn and find someone always seems to be able to help. Few times had a sarcastic person but most everyone is so help. S

Slight problem with this issue. I can now See the table but I can't make any selections....Any new help?
S
 
Last edited:

Users who are viewing this thread

Back
Top Bottom