Wesselcram
New member
- Local time
- Today, 21:19
- Joined
- Jan 8, 2014
- Messages
- 8
Hi,
First of all thanks for all the many, many helpfull information these forums are providing me. However I've uncountered a problem im not able to solve just yet.
I want to fill my 2-column listbox on a form with the help of the following VBA code:
Option Compare Database
Private Sub Form_Load()
Dim proefsel As Integer
Dim nproducts As Integer
Dim i As Integer
proefsel = [Form_begin formulier].lijstproefomschrijving.Value
Set rst = CurrentDb.OpenRecordset("SELECT * FROM termen WHERE proefnr = " & proefsel & "")
i = 0
Me.lstproducts.Clear
rst.MoveFirst
Do Until rst.EOF
Me.lstproducts.AddItem
Me.lstproducts.List(i, 0) = rst![NR]
Me.lstproducts.List(i, 1) = rst![termen]
i = i + 1
rst.MoveNext
Loop
End Sub
When i run the code i get a compile error on the code in bolt. I am using access 2010.
Thanks in advance!
Wessel.
First of all thanks for all the many, many helpfull information these forums are providing me. However I've uncountered a problem im not able to solve just yet.
I want to fill my 2-column listbox on a form with the help of the following VBA code:
Option Compare Database
Private Sub Form_Load()
Dim proefsel As Integer
Dim nproducts As Integer
Dim i As Integer
proefsel = [Form_begin formulier].lijstproefomschrijving.Value
Set rst = CurrentDb.OpenRecordset("SELECT * FROM termen WHERE proefnr = " & proefsel & "")
i = 0
Me.lstproducts.Clear
rst.MoveFirst
Do Until rst.EOF
Me.lstproducts.AddItem
Me.lstproducts.List(i, 0) = rst![NR]
Me.lstproducts.List(i, 1) = rst![termen]
i = i + 1
rst.MoveNext
Loop
End Sub
When i run the code i get a compile error on the code in bolt. I am using access 2010.
Thanks in advance!
Wessel.