Q: how to select a specific cell in order to enter data directly using vba.
Warning - this is likely to offend the purists!!
The following code sits behind a button on a form which itself calls a particular report. This button allows me to inspect and/or edit the raw data in the table, whilst allowing me to see the data for the surrounding records.
Code:
Private Sub OpenItemsButton_Click()
' opens DataItems table for general edit
strTblName = "DataItems"
idFilter = Me.ItemSelector 'ItemSelector is a combo on the controlling form
DoCmd.OpenTable strTblName, acViewNormal, acEdit
DoCmd.FindRecord (idFilter)
On Error GoTo WayOut
DoCmd.GoToRecord , , acNext, 10
DoCmd.GoToRecord , , acPrevious, 10
WayOut:
In effect, this opens the table in a normal view and then moves the cursor so that the required record is visible in the context of its neighbours (ie, +/- 10 adjacent records)
Fine so far!
The main purpose for this devious practice is to add a date into the sixth column of the record, so the basic question is - can I add some code to move the cursor to the sixth column without having to do it manually?