A
anammari
I am relatively new to Access Forms VBA Programming. I'm using 2007 Access
What I want to do is to fill an unbound combox box with values retrieved by a
query when the form starts.
Here are the steps I did:
1. create an unbound form from design view
2. create an unbound combo box on the form. qb1
3. create a query that retrieves values in two table columns. query1.
4. wrote the following code in the "on open" form event:
Private Sub Form_Open(Cancel As Integer)
Dim strRST As String
strRST = "Table/Query"
Me.qb1.RowSourceType = strRST
Me.qb1.RowSource = "query1"
End Sub
However, nothing happens when I switch to form view or close and open the
form directly in form view. The combo box stays empty.
Am I missing something? Is there another way to 'open' the form so the VBA
can run?
Cheers.
What I want to do is to fill an unbound combox box with values retrieved by a
query when the form starts.
Here are the steps I did:
1. create an unbound form from design view
2. create an unbound combo box on the form. qb1
3. create a query that retrieves values in two table columns. query1.
4. wrote the following code in the "on open" form event:
Private Sub Form_Open(Cancel As Integer)
Dim strRST As String
strRST = "Table/Query"
Me.qb1.RowSourceType = strRST
Me.qb1.RowSource = "query1"
End Sub
However, nothing happens when I switch to form view or close and open the
form directly in form view. The combo box stays empty.
Am I missing something? Is there another way to 'open' the form so the VBA
can run?
Cheers.