S
shapper
Hello,
I created a form, named fObras, in Access 2007 with a ListBox named
lbObras.
Then I created a Module to populate the lbObras with the column Name
taken form the table "Obras" in the database 'Fornecedores 2007.mdb".
When I run the form nothing happens. What am I doing wrong?
I think I am missing something that connects the form fObras to my
module code.
Could someone please help me out?
Thanks,
Miguel
This is my module code:
Option Compare Database
Dim dbFornecedores As Database
Dim rsFornecedores As Recordset
Private Sub Form_Load()
Set dbFornecedores = OpenDatabase("Fornecedores 2007.mdb")
Set rsFornecedores = dbFornecedores.OpenRecordset("Obras",
dbOpenDynaset)
If Not rsFornecedores.EOF Then rsFornecedores.MoveFirst
Do While Not rsFornecedores.EOF
lbObras.AddItem rsFornecedores!Nome
lbObras.ItemData(lbObras.NewIndex) = rsFornecedores!ID
rsFornecedores.MoveNext
Loop
End Sub
I created a form, named fObras, in Access 2007 with a ListBox named
lbObras.
Then I created a Module to populate the lbObras with the column Name
taken form the table "Obras" in the database 'Fornecedores 2007.mdb".
When I run the form nothing happens. What am I doing wrong?
I think I am missing something that connects the form fObras to my
module code.
Could someone please help me out?
Thanks,
Miguel
This is my module code:
Option Compare Database
Dim dbFornecedores As Database
Dim rsFornecedores As Recordset
Private Sub Form_Load()
Set dbFornecedores = OpenDatabase("Fornecedores 2007.mdb")
Set rsFornecedores = dbFornecedores.OpenRecordset("Obras",
dbOpenDynaset)
If Not rsFornecedores.EOF Then rsFornecedores.MoveFirst
Do While Not rsFornecedores.EOF
lbObras.AddItem rsFornecedores!Nome
lbObras.ItemData(lbObras.NewIndex) = rsFornecedores!ID
rsFornecedores.MoveNext
Loop
End Sub