-
Solved: open main form by sending info to the subform!
me again!
Thanks to Geekgirlau I have discovered the marvels of using the wizard for making simple code. It solved so many problems that the macro couldn't solve!
But now I have a complicated query that the wizard can't solve. I have a form with a subform that I open whenever I make an order from products, but it doesn't show the product because it is in the subform!
Here is a better explanation (all my fields in the form have the original name of the table values):
FormNewOrder:
orderId
SellerId
CustomerId
VAT
Discount
Charges
Total (unbound Sum)
Subform:
orderdetailsId
orderId(bound it to the FormNewOrders)
productId(see FormProducts)
location (seeFormProducts)
ref
motorId
price
extras
...
-------------- [VBA][/VBA] [VBA][/VBA]
FormProducts:
ProductId
location
ref
...
This is the code from the FormProducts (made thanks to the wizard):
[VBA]
Private Sub OpnFormNewOrder_Click()
On Error GoTo Err_OpnFormNewOrder_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormNewOrder"
stLinkCriteria = "[ProductId]=" & Me![ProductId]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
DoCmd.Close acForm, "FormProducts"
Exit_OpnFormNewOrder_Click:
Exit Sub
Err_OpnFormNewOrder_Click:
MsgBox Err.Description
Resume Exit_OpnFormNewOrder_Click
End Sub
[/VBA]
I understand why it doesn't work, but how can I make it work?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules