Access連番

'AccessSQLで連番(A,Bともに数値)Accessクエリにて実行 'SELECT A, DCount('A','ABC','A <= ' & A) AS AAA FROM ABC; 'UPDATE ABC SET B = DCount('A','ABC','A <= ' & A); Option Explicit Dim cn: Set cn = CreateObject("ADODB.Connection") Const MyDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;"

cn.Open MyDBString cn.Execute "UPDATE ABC SET B = DCount('A','ABC','A <= ' & A);" cn.Close: Set cn = Nothing MsgBox "条項を修正しました"

DoCmd.RunSQL "UPDATE 土地重複 SET ABC = DCount('補番有', '土地重複', '地名地番 = ""' & 地名地番 & '"" AND ID <= ' & ID);"

コメント

Copied title and URL