Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to update a checkbox on another table

Status
Not open for further replies.

StanJx

Programmer
Jun 2, 2016
29
LK
I have a form called frmMaster(tblMaster),n which there is a combo box called cmbRequestID (The combo box is populated from a related table called tblRequest). The table tblRequest has a field called Done which is check box. I need to update this check box when I am saving a record on frmMaster. Would appreciate some help on show i could get this done.
 
Assuming that there is an update process for tblMaster i.e. it is not a bound table, run a recordset to update to change Done from False to True.

Code:
sqlStr="SELECT * FROM tblRequest WHERE RequestID=me.cmbRequestID.value"
Set RSreq=db.openrecordset(sqlStr,dbopendynaset,dbseeChanges)
   rsreq.edit
    rsreq!Done=true
   rereq.update
set RSreq=nothing




Alan
[smurf]
 
Or you can simply execute this statement:

Code:
UPDATE tblRequest
SET Done = True
WHERE RequestID = me.cmbRequestID.value

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
frmMaster is bound to the table tblMaster
 
Yes.. All good.. Had to make some changed and do something different as my data types were different but was able to use those methods to do this.. Thanks for all who replied.. Appreciate it a lot.
 
So which method did you end up using that works for you?

It would be nice for others - who may search this site - to know what worked for you.


Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Andrejek, I added a new dialog form and used the Currentdb.execute "update tblRequest set Done=true where RequestID = " & Me.cmdReqestID statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top