Share via

Error 461

Anonymous
2019-12-16T14:55:10+00:00

How to I get this error to go away? I am trying to make a combo drop down box that auto fills information but I get this error every time I test the drop down. Here is my coding:

Private Sub cboCustomerName_AfterUpdate()

Me.txtCustomerID.Value = Me.cboCustomerName.Column(0)

Me.cboCustomerName.Value = Me.cboCustomerName.Column(1)

Me.txtShipTo.Value = Me.cboCustomerName.Column(2)

Me.txtShipToCity.Value = Me.cboCustomerName.Column(3)

Me.txtShipToState.Value = Me.cboCustomerName.Column(4)

Me.txtShipToZip.Value = Me.cboCustomerName.Column(5)

Me.txtBillTo.Value = Me.cboCustomerName.Column(6)

Me.txtBillToCity.Value = Me.cboCustomerName.Column(7)

Me.txtBillToState.Value = Me.cboCustomerName.Column(8)

Me.txtBillToZip.Value = Me.cboCustomerName.Column(9)

Me.txtPhoneNumber.Value = Me.cboCustomerName.Column(11)

Me.LblCrate.Value = Me.cboCustomerName.Column(11)

Me.txtFPallet.Value = cboCustomerName.Column(12)

Me.LblCreditCard.Value = cboCustomerName.Column(13)

Me.LblProp65Cali.Value = cboCustomerName.Column(14)

End Sub

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2019-12-16T22:42:02+00:00

Hi KaseyJT,

It might be the best option to start from scratch with your combo and take it step by step.

First, open the query you are basing the combo on. Check it to see that all fields you want in your combo are there i.e. 15 or so fields. The first field will be customerID.

Then, open your form. Delete the combo cboCustomerName and delete or comment out the code you have for Private Sub cboCustomerName_AfterUpdate().

Redo the combo based on the query. Leave the column widths at say 1cm or so so you can see all the fields in the combo and know they are showing the correct fields you want, you can make the column widths 0cm later.

Once you are happy the combo is correct and has all the fields look correct, go through each of the unbound text boxes you want to populate, one by one.

If the first textbox is 'customer name' and the second column (first column will be customer id and is column 0) of the combo is customer name then in the control source of the 'customer name' text box add =Me.cboCustomerName.Column(1)

and so on for the remainder of the text boxes, matching the combo box columns with the text boxes.

This will populate all the text boxes with the correct data from the correct columns of your combo box when you select a customer name in the combo

Once you have everything matching up and the text boxes being populated correctly you can set the column widths back to 0 and either leave the text box control sources as is, which will work fine, you don't need the after update of the combo to populate the text boxes, or add back in your code for the after update of the combo, copying each one individually into the code since you now know they are correct, and then deleting the control source for each text box.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Duane Hookom 26,825 Reputation points Volunteer Moderator
2019-12-16T19:43:37+00:00

Here is a break point screen shot. Did you ever add tables to your file? The download you provided has no data.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

19 additional answers

Sort by: Most helpful
  1. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2019-12-16T15:02:18+00:00

    Hi KaseyJT,

    Does your code compile. Can you confirm the left controls are all correctly named and they all accept values? I see three controls with names beginning with "Lbl" which suggests they are label controls. These will not have a Value property since they can't be bound. You could use the Caption property for these.

    It would help to know the exact line that is causing the issue.

    Also, is cboCustomerName bound to a field (has control source)?

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2019-12-16T14:59:07+00:00

    Which line get highlighted as erroneous when you debug the code?

    You've validated all the control names?

    Your coffee compiles without errors?

    Was this answer helpful?

    0 comments No comments