从以下查询中,你们可以选择正在使用哪种表和表列?我是新来的 ms 访问它很混乱,我看了看,是否正在使用下表/列?
表名 || 表列 com020 (.t_nama,.t_namb) mcs031 (.t_suno,.t_dsca)
并在表 com020 中的列 t_cbrn 上进行 RIGHT JOIN。
并且不明白为什么 & ContryCode & 一直在使用。
Sub VSearch(Letter,Name,Vcode,LPage,CurrentPage)
dim countryCode
countryCode = readfromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\HR\DSN\mkCountryCode")
dim oRs2,Query2,i,colourcount
Set oRs2 = Server.CreateObject("ADODB.Recordset")
Query2 = "SELECT com020" & countryCode & ".t_nama, com020" & countryCode & ".t_namb, ttccom020"
& countryCode & ".t_suno, mcs031" & countryCode & ".t_dsca FROM mcs031" & countryCode
& " RIGHT JOIN com020" & countryCode & " ON mcs031" & countryCode & ".t_cbrn = com020" & countryCode & ".t_cbrn "
if letter <> "" then
Query2 = Query2 & "WHERE (com020" & countryCode & ".t_nama) Like '" & QueryFix(Letter) & "%' escape '\' ORDER BY com020" & countryCode & ".t_nama"
elseif name <> "" then
Query2 = Query2 & "WHERE LOWERCASE((com020" & countryCode & ".t_nama)) Like '%" & LCase(Name) & "%' ORDER BY com020" & countryCode & ".t_nama"
elseif Vcode <> "" then
Query2 = Query2 & "WHERE (com020" & countryCode & ".t_suno) Like '%" & UCase(Vcode) & "%' ORDER BY com020" & countryCode & ".t_nama"
elseif LPage <> "" then
Query2 = Query2 & "WHERE (com020" & countryCode & ".t_cbrn) = '" & LPage & "' ORDER BY com020" & countryCode & ".t_nama"
end if