In establishing a request to move items out of a particular office, a Disposal Request form is filled out. The table "Disposal Request" is keyed off the Office # and the Disposal Request # (Disposal Request # starts at 1 for each office, thus it can't be a standalone key). The Item Table has both Disposal Req # and Disposal Req Agency as foreign keys. I am trying to open the "frmItem" using a button and have got stuck on how to compose the Where statement based off both fields. I have tried a number of different approaches, but none have worked. Being new to coding has also limited my options to only very basic ones. I've copied my code below (with my attempt to add the second field to the Where expression).
Also, I want to set the default values for those two fields to equal the Disposal Request form's values so users can just key in items to the items form if they open it from the Disposal Request form (not the only way they can access the Item form). I would set the default values on the Items form to equal the Disposal Request form, but items also come in from two other sources. That's why I'm trying to put this in the code. A sub form would work, but I'm trying to avoid this b/c there are a lot fields in the Item table.
I've looked on the forum for help on these issues but wasn't able to find anything I could directly apply, if I missed something feel free to point me in the right direction.
I'm running windows 2000 SP-3.
Any help would be appreciated, thanks!
-Steve
Also, I want to set the default values for those two fields to equal the Disposal Request form's values so users can just key in items to the items form if they open it from the Disposal Request form (not the only way they can access the Item form). I would set the default values on the Items form to equal the Disposal Request form, but items also come in from two other sources. That's why I'm trying to put this in the code. A sub form would work, but I'm trying to avoid this b/c there are a lot fields in the Item table.
I've looked on the forum for help on these issues but wasn't able to find anything I could directly apply, if I missed something feel free to point me in the right direction.
I'm running windows 2000 SP-3.
Code:
Private Sub cmdAddItems_Click()
On Error GoTo Err_cmdAddItems_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmItem"
stLinkCriteria = "[DisposalReqOffice] & [DisposalReqNum]=" & Me![cboOfficeNum] & Me![txtDisposalReqNum]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAddItems_Click:
Exit Sub
Err_cmdAddItems_Click:
MsgBox Err.Description
Resume Exit_cmdAddItems_Click
End Sub
Any help would be appreciated, thanks!
-Steve