多表查询
Private Sub Form_Load()Form4.Text1.Text = Form2.Text1.Text
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\win.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select select 读者编号,读者姓名,书籍名称 from b,c where b.读者编号=c.读者编号"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
----------------------------------------------------------------------------------------------------
Private Sub Command1_Click()
Call CX '调用函数
End Sub
----------------------------------------------------------------------------------------------
Public Sub CX()
If Check1.Value = 1 And Check2.Value = 0 Then
Adodc1.RecordSource = "select 读者编号,读者姓名,书籍名称 from b,c where b.读者编号=c.读者编号 and like'" & Trim(Text2.Text) & "' "
Adodc1.Refresh
ElseIf Check1.Value = 0 And Check2.Value = 1 Then
Adodc1.RecordSource = "select 读者编号,读者姓名,书籍名称 from b,c where b.读者编号=c.读者编号 and year(出生日期)=" & Trim(Text3.Text) & ""
Adodc1.Refresh
ElseIf Check1.Value = 1 And Check2.Value = 1 Then
Adodc1.RecordSource = "select 读者编号,读者姓名,书籍名称 from b,c where b.读者编号=c.读者编号 and 读者编号 like'" & Trim(Text2.Text) & "'and year(出生日期)=" & Trim(Text3.Text) & ""
Adodc1.Refresh
End If
End Sub
-------------------------------------------------------------------------
我做的一个多表查询 表名 B,C 那位高手看看我哪错了,我是新手底子不扎实请指点下