# Revision history [back]

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records ans four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Sample: FirstMacros.odb

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records ans and four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Edited code to remove confusing Mri lines.

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records and four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Edit 10/31/2016:

Modified code per @peterwt comment. Also added Option Explicit and some missing Dim statements.

Sample: FirstMacro.odbFirstMacros.odb Edited code to remove confusing Mri lines.

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records and four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Edit 10/31/2016:

Modified code per @peterwt comment. Also added Option Explicit and some missing Dim statements.

Sample: FirstMacros.odb

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records and four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Edit 10/31/2016:

Modified code per @peterwt comment. Also added Option Explicit and some missing Dim statements.

Sample: FirstMacros.odb

Edit 11/02/2016:

Place a button on the form and attach the following macro to the Execute action event.

Sub RgNr_kopieren (oEvent AS OBJECT)
REM copy RgNr from the first row to all others
Dim oForm AS OBJECT
Dim inRgNr AS LONG
Dim loRecPtr As Long
oForm = oEvent.Source.Model.Parent
REM loRecPtr used to get records - initially set it to get first record
loRecPtr = 1
oForm.absolute(loRecPtr)
inRgNr = oForm.getLong(10)
Rem Loop through records
While Not oForm.isLast()
Rem increment Pointer to record by one (to get next record)
loRecPtr = loRecPtr + 1
oForm.absolute(loRecPtr)
Rem must use oForm. in next two lines - this is in the book!
oForm.updateLong(10,inRgNr)
oForm.updateRow()
Wend
MsgBox "Update Completed"
End Sub