I am new to VBA, my experience is with VFP. I am running into the problem of moving from one form to another with the same table and getting the error that the table is already open. The table is used to collect statistical data based on choices made on screen1 and displayed on screen2. A part of the code looks like this:
Code:
' Code on screen1 button to display screen2
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Set db = CurrentDb
Set rs1 = db.OpenRecordset("tblControl", dbOpenTable)
rs1.Edit
' Code goes here to calculate.
rs1!PercentCancel = Round((rs1!CancelOnTime / rs1!CancelCount), 4)
rs1.Update
rs1.Close
' Screen2 (frmStats) uses tblControl in the Form Property Record Source
DoCmd.OpenForm "frmStats"
Note: I have reviewed many articles and advice, most of which is "How do you make it read only?" "How do you make it exclusive?" I have seen the term "Shared" used in descriptions, but never in the code. As I said, my experience is with VFP. In VFP the command would simply be: "Use tblControl Shared".
Thank you in advance.