- Private Sub CommandButton1_Click()
- Dim conn As Object
- Dim rst As Object
- Dim Sql$
- ' Sql = "SELECT 预约记录.ID,预约记录.会员名,预约记录.拍摄日期,预约记录.时间,预约记录.妈妈姓名,预约记录.出生时间,会员记录.手机,会员记录.手机电话,预约记录.性别,预约记录.年龄,预约记录.拍摄类型,预约记录.拍摄地址,预约记录.预约套系,预约记录.摄影师 FROM 预约记录 INNER JOIN 会员记录 ON 预约记录.会员名 = 会员记录.会员名 "
- Sql = "Select b.ID,b.会员名,b.拍摄日期,b.时间,b.妈妈姓名,b.出生时间,a.手机,a.手机电话,b.性别,b.年龄,b.拍摄类型,b.拍摄地址,b.预订套系,b.摄影师 From 预约记录 as b,会员记录 as a Where b.妈妈姓名='" & [b8] & "' and a.妈妈姓名='" & [b8] & "'"
- Set conn = CreateObject("adodb.connection")
- With conn
- .Provider = "microsoft.ACE.oledb.12.0"
- .ConnectionString = "Data Source =" & ThisWorkbook.Path & "\shuju.accdb"
- .Open
- End With
- [B19].CurrentRegion.Offset(1).ClearContents
- [B20].CopyFromRecordset conn.Execute(Sql)
- ' rst.Close
- conn.Close
- Set conn = Nothing
- End Sub
复制代码 |