若需在ADO查询中对多个项进行操作,可以按以下方式进行:
SELECT * FROM table_name WHERE item1 = 'value1' AND item2 = 'value2'
SELECT * FROM table_name WHERE item1 IN ('value1', 'value2', 'value3')
SELECT * FROM table_name WHERE item1 = 'value1' OR item2 = 'value2'
示例代码:
Dim conn As ADODB.Connection Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\data\database.accdb;" conn.Open
Set rs = New ADODB.Recordset rs.ActiveConnection = conn rs.Open "SELECT * FROM table_name WHERE item1 = 'value1' AND item2 = 'value2'"
'使用rs操作记录集
rs.Close conn.Close