filter w/ default value problem

shiner

Registered User.
Local time
Today, 21:07
Joined
Feb 6, 2003
Messages
30
Hi,
I have a link off of my personnel details page to issue that person equipment. The link opens another form, and the filter essentially grabs anything from my equipment issue table that is from the referenced personnel_id. Here is the VB script that access came up with for this button:

******
On Error GoTo Err_Command282_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "issue_equipment_item"

stLinkCriteria = "[personnel_ID]=" & Me![personnel_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command282_Click:
Exit Sub

Err_Command282_Click:
MsgBox Err.description
Resume Exit_Command282_Click
*******

Now, on this issue_equipment_item form, there are only three fields - equipment item, personnel_ID, and size. You will see on the attached screen shot what I am looking at. The person in this example has 13 items checked out - hence the 13 records. This new form is based on the table issued_equipment and the results are filtered on the personnel_ID from the previous screen - you can see it behind the new form in the screenshot.

I want this form to open with a default value filled in for personnel_ID. How do I make this happen? When I set the default value field to:

=[Forms]![personnel_subform]![personnel_ID]

I get a ?name error because the issue_equipment_item form is based on the issued_equipment table.

I am new to filters, but I just dont understand the logic behind how the db can assign the filter to be [personnel_ID]=(whatever number came from the other form), but I can not get the personnel_ID field on that form to also share this value.
 

Attachments

  • issue.gif
    issue.gif
    15 KB · Views: 131
shiner,

Assuming that the form is really open:

=[Forms]![personnel_subform]![personnel_ID]

I'm thinking that you need:

=[Forms]![Main]![personnel_subform]![personnel_ID]

Where [Main] is the name of your Main Form. The name
[personnel_subform] implies that it is a subform to some
main form.

Additionally, you can look at the Master-Child links as a
way of doing this.

Wayne
 

Users who are viewing this thread

Back
Top Bottom