Freedom Computers

ACCESS

Simple Code.

Private Sub Command0_Click()

'Make sure that Tools-References has 'Microsoft DAO 3.6 Object Lib' selected


Dim MYDB As Database

Set MYDB = DBEngine.Workspaces(0).Databases(0)


Dim RecSet As Recordset

Set RecSet = MYDB.OpenRecordset("T-TEST", DB_OPEN_DYNASET)


RecSet.MoveFirst

‘Or RecSet.AddNew

Do Until RecSet.EOF

    x = x + 1

    RecSet.Edit

        RecSet![Amount] = x * 100

        RecSet![text1] = Chr(x + 32)

        RecSet![text2] = Chr(x + 65)

        RecSet![email] = Chr(x + 66)

    RecSet.Update

    RecSet.MoveNext

Loop


Response = MsgBox("Update completed")



End Sub

…..............................................................

Useful commands


MYTABLE.MoveFirst

Do Until MYTABLE.EOF

'Read Line of Data
Data = MYTABLE![FIELD1]


'Fill fields with data and prepare to add new records
Mainfile.AddNew
Mainfile![HouseNo] = NumberName
Mainfile![Street] = Road
Mainfile![postcode] = pcode
Mainfile![price] = price
Mainfile![Datesold] = saledate

Mainfile.Update


MYTABLE.MoveNext

Loop




End Sub