2
可以选择使用哪种表格和表格列?我是新来的MS访问它相当混乱,我看了一下,是否使用了以下 表/列?从以下查询中了解msaccess查询
表名||表列 com020(.t_nama,.t_namb) mcs031(.t_suno,.t_dsca)
以上表列com020 RIGHT t_cbrn 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
你试过调试过吗? – Arion 2012-04-27 06:12:08
这些列是** t_nama **,** t_namb **,** t_suno **,** t_dsca ** 但是,您的所有表都使用countryCode命名,例如,如果CountryCode是** ABC **,您的表名将是** msc031ABC **,** com020ABC ** – Nick 2012-04-27 06:13:11
谢谢Nick!我现在明白了。 – 2012-04-27 06:17:03