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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need code to edit other table 1

Status
Not open for further replies.

JLSigman

Programmer
Sep 20, 2001
261
US
In this file room database, they wanted to change how the checking in of files was done. What I need to be able to do is on the "Before Update" event is go edit the record that matches the permit number in the Permit table of the permit they're working on in the History table.

In other words... they're checking in permit #200. The History table has who it was previously checked out by, and they're putting the check-in date. In the Permit table, it also indicates that the file is checked out, so I need to change that as well.

If you need more clarification, let me know. Jennifer Sigman
Code-borrower extraordinaire
"They call us public servants for a reason..."
 
Hi Jennifer!

Try this:

Dim rstPermit As DAO.Recordset

Set rstPermit = CurrentDb.OpenRecordset("PermitTable", dbOpenDynaset)

rstPermit.FindFirst "PermitNumber = '" & Me!txtPermitNumber & "'"

If rst.NoMatch = True Then
Call MsgBox("There is no matching record in the Permit Table! Please make the appropriate change.", vbCritical)
Else
rstPermit.Edit
rstPermit!CheckedOut = False
rstPermit.Update
End If

Set rst.Permit = Nothing

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks! I'll try this out and let you know if I have any more questions. Jennifer Sigman
Code-borrower extraordinaire
"They call us public servants for a reason..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top