문제

I'm new to forms in access, so I apologize for asking about something that is probably simple. I am trying to get the chosen value from a combo drop-down into another table. But I am having trouble retrieving the data. I even tried something as simple as just putting it into a message box. After looking up on line I came up with:

Private Sub Combo()
    MsgBox Me.Combo.Column(0)
End Sub

All I get is invalid use of Me Keyword. The Combo's name has been changed to Combo in properties. The values come from table4 (column1) Please help.

도움이 되었습니까?

해결책

I just used the same exact code you have listed above MsgBox Me.Combo.Column(1) Something is wrong with one of the following:

  1. Your control is not named Combo
  2. You do not have a value picked in the combobox
  3. Or you record source for the combobox is not returning any results.

Please post the combobox recordsource. If you provide more information, I can assist you better but those are the most common problems with invalid use of null with comboboxs

EDIT

I noticed in your code that you have Me.Combo.Column(1) and it should be Me.Combo.Column(0) since you only have 1 column it is a zero based index. Additionally, I would create that code within the vba for that form. If you click on that combo-> properties-> event tab-> Afterupdate -> ... -> codebuilder and add your code there, it will do whatever after you update the combo box.

다른 팁

Make sure you are writing the code inside the form where your comboBox is placed and also try for this

MsgBox Me.Combo.Column(0,1)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top