I recently took on a small Access project. I moved everything to a SQL backend (i'm a SQL Dba, not an Access person) and one of the forms isn't working. This is basically a form that collects information and posts it to the linked SQL table.
Whoever wrote the code added a Clear button at the top and specified to click it before adding a new record. Here is the code for the button.
Private Sub cmdClear_Click()
' Set Screen values to zero
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Methadone = Null
D = Null
DIA = Null
CELEX = Null
K = Null
ZY = Null
Hydrox = Null
A = Null
G = Null
Methadone.SetFocus
It is erroring out on the DoCmd line, stating that You can't go to the specified record. This worked when the table was an Access table, but when it moved to SQL it errored. There is a primary key on an ID field that shows up when the form is loaded. I thought that SQL can't advance a record like Access can, but I am unfamiliar with what this line of code means. can anyone help??
Whoever wrote the code added a Clear button at the top and specified to click it before adding a new record. Here is the code for the button.
Private Sub cmdClear_Click()
' Set Screen values to zero
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Methadone = Null
D = Null
DIA = Null
CELEX = Null
K = Null
ZY = Null
Hydrox = Null
A = Null
G = Null
Methadone.SetFocus
It is erroring out on the DoCmd line, stating that You can't go to the specified record. This worked when the table was an Access table, but when it moved to SQL it errored. There is a primary key on an ID field that shows up when the form is loaded. I thought that SQL can't advance a record like Access can, but I am unfamiliar with what this line of code means. can anyone help??