hi guys
i've copied and altered the code below to populate a combo box with table names. all works fine except when i click a table name in the combo box to select it i get the message
microsoft access cannot find the macro "."
Private Sub Form_Load()
'ValueList variable will store a string that can
'be used as the Value List property for a combo box.
Dim ValueList As String
ValueList = ""
Dim op As String
op = Chr(34)
'Loop through all table names.
'For Each AccessObject In CurrentProject.AllTables
For Each tbl In CurrentData.AllTables
'code to exclude system tables which begin with "msys"
If Not Left(tbl.Name, 4) = "msys" Then
ValueList = ValueList + op + tbl.Name + op + ";"
End If
Next tbl
'Add current report name and semicolon to ValueList variable.
'Now make ValueList the Value List for the cbotables combo box.
Me!cbotables.RowSourceType = "Value List"
Me!cbotables.RowSource = ValueList
Me!cbotables.Requery
'Set the value of the ReportName control to the first item in the list.
Me!cbotables.Value = Me!cbotables.ItemData(0)
End Sub
i can't find anything wrong with the code above. can anyone see why i should get this message??
thanks in advance
i've copied and altered the code below to populate a combo box with table names. all works fine except when i click a table name in the combo box to select it i get the message
microsoft access cannot find the macro "."
Private Sub Form_Load()
'ValueList variable will store a string that can
'be used as the Value List property for a combo box.
Dim ValueList As String
ValueList = ""
Dim op As String
op = Chr(34)
'Loop through all table names.
'For Each AccessObject In CurrentProject.AllTables
For Each tbl In CurrentData.AllTables
'code to exclude system tables which begin with "msys"
If Not Left(tbl.Name, 4) = "msys" Then
ValueList = ValueList + op + tbl.Name + op + ";"
End If
Next tbl
'Add current report name and semicolon to ValueList variable.
'Now make ValueList the Value List for the cbotables combo box.
Me!cbotables.RowSourceType = "Value List"
Me!cbotables.RowSource = ValueList
Me!cbotables.Requery
'Set the value of the ReportName control to the first item in the list.
Me!cbotables.Value = Me!cbotables.ItemData(0)
End Sub
i can't find anything wrong with the code above. can anyone see why i should get this message??
thanks in advance