G
Garry
I am very puzzled. I am creating a database (access 2000, DAO) and in one
case I have to automatically create a new record in a table (tblReturn) that
is not “attached†to the current form. In VBA I open a recordset based on
tblReturn, add a new record, update the table
set recordset = db.openrecordset(“tblReturnâ€)
rec.addnew
--- add data to the recordset
rec.update
rec.close
All works, the new record appears in the form.
One field in the table must be entered by the user, so I open a new form
(data source is tblReturn), with focus set on the control bound to the field
that needs to be entered, with WindowMode:=acDialog, so when the new form is
closed, I go back to the first form. The forms OnCurrent event moves to the
last record using the DoCmd.GoToRec acLast. The control that accepts input
has enabled=Yes, locked=No (all other controls on the form have enabled=no,
locked=yes – so the user doesn’t accidently change something). When the form
opens, it shows the last record (entered in VBA), but the problem is that the
control will not accept any data, it looks like the control has enabled =
Yes, and locked = Yes, i.e. cursor is in the control but you cannot change
the default value.
If I delete control source for the control so it is unbound, I can enter data.
The new form (tblReturn) is based on an another existing form used by the
user to enter all data into the table manually, and it works fine. The only
form property I changed was the OnCurrent event to go to the last record.
Does anyone have any ideas?? -- Thanks, Garry Gross
case I have to automatically create a new record in a table (tblReturn) that
is not “attached†to the current form. In VBA I open a recordset based on
tblReturn, add a new record, update the table
set recordset = db.openrecordset(“tblReturnâ€)
rec.addnew
--- add data to the recordset
rec.update
rec.close
All works, the new record appears in the form.
One field in the table must be entered by the user, so I open a new form
(data source is tblReturn), with focus set on the control bound to the field
that needs to be entered, with WindowMode:=acDialog, so when the new form is
closed, I go back to the first form. The forms OnCurrent event moves to the
last record using the DoCmd.GoToRec acLast. The control that accepts input
has enabled=Yes, locked=No (all other controls on the form have enabled=no,
locked=yes – so the user doesn’t accidently change something). When the form
opens, it shows the last record (entered in VBA), but the problem is that the
control will not accept any data, it looks like the control has enabled =
Yes, and locked = Yes, i.e. cursor is in the control but you cannot change
the default value.
If I delete control source for the control so it is unbound, I can enter data.
The new form (tblReturn) is based on an another existing form used by the
user to enter all data into the table manually, and it works fine. The only
form property I changed was the OnCurrent event to go to the last record.
Does anyone have any ideas?? -- Thanks, Garry Gross