A
Adrienne
Back by popular demand:
I have to use a VBA code on a project.
I have a Form_Copy of qry:CANTEST and a table entitled
tbl:CANFY2003 I'm trying to build a combo box and perform
a Visual Basic Autofill for a project that I'm working on.
I went into the existing text box labeled NEW_CAN and
changed it to a combo box. After which I pulled up the
properties tab and typed into Row Source the following:
Select
NEWCAN#,txtCAN,txtRESEARCH,txtDIVISION,txtPOOL,txtNotes
From tbl:CANFY2003ORDER BY txtNEWCAN#;
Also I typed into column widths:
0";6";0";0";0"
Next, I click on AfterUpdate and open the Code window and
typed:
Option Compare Database
Private Sub Form_AfterUpdate()
End Sub
Private Sub NEW_CAN___AfterUpdate()
' columns are zero based
' control_on_form = combo_box_column ()
NEW_CAN = Me.NEW_CAN__.Column(1) '0789"
Research = Me.NEW_CAN__.Column(2) 'BIOD"
Division = Me.NEW_CAN__.Column(3) 'DAIDS"
POOL = Me.NEW_CAN__.Column(4) 'RPG"
Notes = Me.NEW_CAN_.Column(5) 'Research Projects"
End Sub
I tried to run the code but no error occurred and when I
went back to the form and clicked on Datasheet view the
NEW_CAN# field is now blank???? What am I doing wrong, I
have 150 different CAN #'s and over 6000 transaction. I
have to use a VBA Code to do an auto fill for the columns
above. Maybe you can urgently help!!!
I have to use a VBA code on a project.
I have a Form_Copy of qry:CANTEST and a table entitled
tbl:CANFY2003 I'm trying to build a combo box and perform
a Visual Basic Autofill for a project that I'm working on.
I went into the existing text box labeled NEW_CAN and
changed it to a combo box. After which I pulled up the
properties tab and typed into Row Source the following:
Select
NEWCAN#,txtCAN,txtRESEARCH,txtDIVISION,txtPOOL,txtNotes
From tbl:CANFY2003ORDER BY txtNEWCAN#;
Also I typed into column widths:
0";6";0";0";0"
Next, I click on AfterUpdate and open the Code window and
typed:
Option Compare Database
Private Sub Form_AfterUpdate()
End Sub
Private Sub NEW_CAN___AfterUpdate()
' columns are zero based
' control_on_form = combo_box_column ()
NEW_CAN = Me.NEW_CAN__.Column(1) '0789"
Research = Me.NEW_CAN__.Column(2) 'BIOD"
Division = Me.NEW_CAN__.Column(3) 'DAIDS"
POOL = Me.NEW_CAN__.Column(4) 'RPG"
Notes = Me.NEW_CAN_.Column(5) 'Research Projects"
End Sub
I tried to run the code but no error occurred and when I
went back to the form and clicked on Datasheet view the
NEW_CAN# field is now blank???? What am I doing wrong, I
have 150 different CAN #'s and over 6000 transaction. I
have to use a VBA Code to do an auto fill for the columns
above. Maybe you can urgently help!!!