Referencing a Combo Box

Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc used Ask the Experts™
on
Hi

How best to reference a combo box (CboGrn) from the parent form while in the sub form , I have tried this code below:

If (Me.CboGrn) <> Me.Parent!CboGrn.Clumn(1) Then
MsgBox " Please Check the selection is wrong try again"
Cancel = True
Exit Sub
End If
End Sub
I want to get the column 1 of the parent combo box , the code is on the form before update event, could it be this part Me.Parent!CboGrn.Clumn(1) is not correct. The error here is Me.Parent!CboGrn.Clumn(1) data part not found.

Are there any issues here to fix here??????

Regards

Chris
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ryan ChongSoftware Team Lead
Commented:
Clumn

??

typo in question or in your code?

shouldn't it be as Column?
Database Expert
Awarded 2016
Top Expert 2016
Commented:
Ryan is correct.

Please try like this -

If (Me.CboGrn) <> Me.Parent!CboGrn.Column(1) Then

Combox box has a column property and inside that you can pass the index...

refer for more
https://msdn.microsoft.com/en-us/vba/access-vba/articles/combobox-column-property-access
Yes correct typo error

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial