0
でAccessテーブルを埋める私は、Excelでfuctionality同じラインfilldownを持つことができ、私は更新クエリを探しています下の列自動更新クエリ
Id process
1 Lotus
2
3
4 Rose
5
6
7
8 Lilly
9
10
、とアクセスのテーブルを持っています。
でAccessテーブルを埋める私は、Excelでfuctionality同じラインfilldownを持つことができ、私は更新クエリを探しています下の列自動更新クエリ
Id process
1 Lotus
2
3
4 Rose
5
6
7
8 Lilly
9
10
、とアクセスのテーブルを持っています。
これは、あなたが望むことをします。
Private Sub Command1_Click()
Dim Rs As Recordset, strSQL As String, CurData As Variant
'Note: Set a reference to the Microsoft DAO Object library via Tools | References
'Amend this to indicate the table and sort by the autonumber id
strSQL = "SELECT * FROM YOUR_TABLE"
'Opens a recordset (like a query) to the table
Set Rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
'Loop through the records in the table and if the previous row didnt have data in the
'Repaired_By field then populate the previous Repaired_By data. Assumes the first record is
'populated with info
Rs.MoveLast
Rs.MoveFirst
Do
If Rs!CONTACT_ID = "" Or IsNull(Rs!CONTACT_ID) Then
'This field is blank so populate the info from the variable
Rs.Edit
Rs!CONTACT_ID.Value = CurData
Rs.Update
Else
'This field isnt blank so store the info in the variable in case the next record is blank
CurData = Rs!CONTACT_ID.Value
End If
Rs.MoveNext
Loop While Not Rs.EOF
'Remove the recordset object from memory
Rs.Close
Set Rs = Nothing
End Sub