Can't Find Form erro (1 Viewer)

schumarg

Registered User.
Local time
Today, 06:44
Joined
May 13, 2003
Messages
94
Hi,

I have a form with a subform in it. I want to double-click one the the fields in the subform (PurchaseOrd) and have a tblPurchaseOrder2 form open to that particular record so I can edit a value in the record. (The value in the subform that I want to edit is based on an expression from a query, so I have to go back to the main table and edit one of the P/O's invoices.)

I have a double-click event on the field in the subform to open the PurchaseOrder2 form, and it does without a "Where" clause, but if I put a "Where" clause, then it can't find the form. :confused:

I've tried the following, but get suspect, I hope, that the syntax is not correct:

DoCmd.OpenForm "tblPurchaseOrder2", acNormal, , [Forms]![tblPurchaseOrder2]![PurchaseOrd] = [Forms]![tblPurchaseOrder subform]![PurchaseOrd]

Any suggestions would be greatly appreciated.
 

Mile-O

Back once again...
Local time
Today, 11:44
Joined
Dec 10, 2002
Messages
11,316
It needs to be a field that equals a value, and the criteria must be a string - you can, however, build this from actual values.


i.e.


"[MyField] = " & MyValue
 

schumarg

Registered User.
Local time
Today, 06:44
Joined
May 13, 2003
Messages
94
Thanks,

Getting there, it now opens to a blank record, not the record I need to edit.

Have the following now:

Private Sub Purchase_Order_DblClick(Cancel As Integer)

Dim PONum As String
PONum = [PurchaseOrd]
DoCmd.OpenForm "tblpurchaseorder2", acFormDS, , [PurchaseOrd] = "PONum"

End Sub
 

Mile-O

Back once again...
Local time
Today, 11:44
Joined
Dec 10, 2002
Messages
11,316
schumarg said:
DoCmd.OpenForm "tblpurchaseorder2", acFormDS, , [PurchaseOrd] = "PONum"

DoCmd.OpenForm "tblpurchaseorder2", acFormDS, , "[PurchaseOrd] = " & PONum
 

schumarg

Registered User.
Local time
Today, 06:44
Joined
May 13, 2003
Messages
94
Hi,

Hate to be a pest, but.....

Now I get Run-time error '2501':

The OpenForm action was canceled.
Saying I clicked Cancel in a dialog box.



:confused: :confused:
 

Users who are viewing this thread

Top Bottom