问题
I need to open a specific form by a click on a subform record name. The name in the subform is showed as a combobox with ID and Name as columns.
I did like this:
Private Sub ID_Prodotto_DblClick(Cancel As Integer)
Dim Id As Integer
Id = Me.ID_Prodotto.Column.Value
DoCmd.OpenForm "Prodotto", , , "ID_Prodotto = " & Id
End Sub
But Access requires me to manually insert the ID Field Value as I click on the record. Where am I wrong?
回答1:
It should read:
Id = Me!ID_Prodotto.Value
or, if you wish to use the value from column number n (0 is the first):
Id = Me!ID_Prodotto.Column(n)
来源:https://stackoverflow.com/questions/45588915/access-open-form-with-where-clause