Adds items from a DBF table to a ComboBox or ListBox control.
object.AddItemsFromTable ( TableName, ValueField, TextField [,Expression] ) |
- TableName
- Required. A String that specifies the fully qualified path of the DBF table.
- ValueField
- Required. A String that specifies the value field of the DBF table.
- TextField
- Required. A String that specifies the text field of the DBF table.
- Qualifier
Long
Expression is a string specifying the filter used to limit items added from the table in the form: "[FIELD] = VALUE".
For example, if you only want to add items to the control with the value John for the field called NAME, you would use:
"[NAME] = ""John"""
If you want to add items to the control with the values John or Sally, you would use:
"[NAME] = ""John"" OR [NAME] = ""Sally"""
If you want to add items to the control with values beginning with J, you would use:
"[NAME] >= ""J"" AND [NAME] < ""K"""
When using variables as part of the expression, you need to build up the expression using the contents of the variables rather than the names of the variables. For example, if you want to search for the value stored in the variable strName, you would use:
"[NAME]=""" & strName & """"
Note the double quotes inside the expression. This is how you place a string inside another string in VBScript (the Expression argument itself is a string). Here's an example using a numeric field:
"[AGE] > 10"
The AddItemsFromTable method returns the number of items added to the control.
For example, if you only want to add items to the control with the value John for the field called NAME, you would use:
"[NAME] = ""John"""
If you want to add items to the control with the values John or Sally, you would use:
"[NAME] = ""John"" OR [NAME] = ""Sally"""
If you want to add items to the control with values beginning with J, you would use:
"[NAME] >= ""J"" AND [NAME] < ""K"""
When using variables as part of the expression, you need to build up the expression using the contents of the variables rather than the names of the variables. For example, if you want to search for the value stored in the variable strName, you would use:
"[NAME]=""" & strName & """"
Note the double quotes inside the expression. This is how you place a string inside another string in VBScript (the Expression argument itself is a string). Here's an example using a numeric field:
"[AGE] > 10"
The AddItemsFromTable method returns the number of items added to the control.