筆者今天在寫 ACCESS VBA (Visual Basic for Applications)程式,碰到了程式有錯誤,無法運行,嘗試和更改了很多次,都沒法成功,而 VBA 程式如下的句子。
Microsoft Access VBA 句子 |
後來發覺可能是 ACCESS 的保留字(Reserved Words)的問題,便在網上查找,原來真的是這個問題,將 LEVEL 改了做 CLASS,便解決了,所以將保留字紀錄下來,用作參考之用。
SourceDb.Execute "UPDATE BOM_MST " _ & "Set COMPANY = '" & Me.Text_Company & "', " _ & "LEVEL = '" & Me.Text_Level & "', " _ & "WHERE BOM_MST.ID = " & Me.Text_ID & ";" |
Microsoft Access 會保留一些字和符號作為程式使用,如果使用保留字命名控件、對像或變量,也可能會遇到錯誤。你收到的錯誤消息不一定告訴您保留字是問題的原因。保留字(Reserved Words)是對 Microsoft Access 具有特定含義的詞和符號。如果你使用保留字或符號來命名桌面數據庫或 Web 應用程序表中的字段,Access 會警告您該字已保留,並且您在引用該字段時可能會遇到錯誤。
Microsoft Access 保留字(Reserved Words):
1-24 |
25-48 |
49-72 |
73-96 |
97-120 |
121-144 |
145-168 |
169-184 |
ADD |
COUNTER |
DOUBLE |
HAVING |
Match |
Parameter |
RIGHT |
UNIQUE |
ALL |
CREATE |
DROP |
Idle |
Max, Min, Mod |
PARAMETERS |
SCREEN |
UPDATE |
Alphanumeric |
CreateDatabase |
Echo |
IEEEDOUBLE, IEEESINGLE |
MEMO |
Partial |
SECTION |
USER |
ALTER |
CreateField |
Else |
If |
Module |
PERCENT |
SELECT |
VALUE |
AND |
CreateGroup |
End |
IGNORE |
MONEY |
PIVOT |
SET |
VALUES |
ANY |
CreateIndex |
Eqv |
Imp |
Move |
PRIMARY |
SetFocus |
Var, VarP |
Application |
CreateObject |
Error |
IN |
NAME |
PROCEDURE |
SetOption |
VARBINARY, VARCHAR |
AS |
CreateProperty |
EXISTS |
INDEX |
NewPassword |
Property |
SHORT |
WHERE |
ASC |
CreateRelation |
Exit |
Index, Indexes |
NO |
Queries |
SINGLE |
WITH |
Assistant |
CreateTableDef |
Field, Fields |
INNER |
Not |
Query |
SMALLINT |
Workspace |
AUTOINCREMENT |
CreateUser |
FillCache |
INSERT |
Note |
Quit |
SOME |
Xor |
Avg |
CreateWorkspace |
FLOAT, FLOAT4, FLOAT8 |
InsertText |
NULL |
REAL |
SQL |
Year |
BETWEEN |
CURRENCY |
FOREIGN |
INT, INTEGER, INTEGER1, INTEGER2, INTEGER4 |
NUMBER, NUMERIC |
Recalc |
StDev, StDevP |
YES |
BINARY |
CurrentUser |
Form, Forms |
INTO |
Object |
Recordset |
STRING |
YESNO |
BIT |
DATABASE |
FROM |
IS |
OFF |
REFERENCES |
Sum |
FALSE |
BOOLEAN |
DATE |
Full |
JOIN |
OLEOBJECT |
Refresh |
TABLE |
TRUE |
BY |
DATETIME |
FUNCTION |
KEY |
ON |
RefreshLink |
TableDef, TableDefs |
|
BYTE |
DELETE |
GENERAL |
LastModified |
OpenRecordset |
RegisterDatabase |
TableID |
|
CHAR, CHARACTER |
DESC |
GetObject |
LEFT |
OPTION |
Relation |
TEXT |
|
COLUMN |
Description |
GetOption |
Level |
OR |
Repaint |
TIME, TIMESTAMP |
|
CompactDatabase |
DISALLOW |
GotoPage |
Like |
ORDER |
RepairDatabase |
TOP |
|
CONSTRAINT |
DISTINCT |
GROUP |
LOGICAL, LOGICAL1 |
Orientation |
Report |
TRANSFORM |
|
Container |
DISTINCTROW |
GROUP BY |
LONG, LONGBINARY, LONGTEXT |
Outer |
Reports |
Type |
|
Count |
Document |
GUID |
Macro |
OWNERACCESS |
Requery |
UNION |
|
沒有留言:
張貼留言