CurrentDb.QueryDefs("查询名称").SQL = "select * from table1" |
Dim dbs As Database, strSQL1 As String, strSQL2 As String Dim qdf1 As QueryDef Set dbs = CurrentDb strSQL1 = "SELECT 职工表.* " & _ "FROM 职工表 " & _ "WHERE (((职工表.性别)" & GenderNo & ") " & _ "AND ((职工表.是否已婚)" & Married & ") " & _ "AND ((职工表.编制)" & PList & ")" strSQL2 = ");" Set qdf1 = dbs.CreateQueryDef("~人员查询", strSQL1 + strSQL2) DoCmd.OpenQuery qdf1.Name dbs.Close |
roych 发表于 2013-1-27 23:07
类似的例子很多:http://www.office-cn.net/thread-94266-1-1.html
温馨提醒一句,楼主注意不要舍本逐末。 ...
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |