Linked forms and parameter transfer

inoxo

Registered User.
Local time
Today, 17:03
Joined
Sep 8, 2005
Messages
42
Hello,

I have a form "article" with a button "place an order". Click on the button opens another form ("order") where I should fill the order for the current article.

The problem : how can I tell to "order" form that I want to order the article I was on in my "article" form, and not another one ?

Thanks
 
Yes, but ...

Thanks John.

Your solution works fine if a record already exists in the table "order" (2nd form).

However, when I am on the "article" form (1st form) and I click on the button "order this article", I should open the "order" form on a new record, and fill it with the linked key (idArticle).

I believe this could be done by passing idArticle to the second form when clicking on the button which opens it, but I don't know how to do it ...
Any other suggestion would be welcome, off course.

Thanks.
 
Your solution works fine if a record already exists in the table "order" (2nd form).

Wrong.

You can add a record to the subform (or as you call it 2nd form) and it will automatically link to the record in the main form.

You can also add a NEW record in the Main form and then add a record in the subform.

You must be looking at a different sample.

See the attached screen dump & also have a look at the code in the OnCurrent event of the subform:


Code:
Dim iMain As Integer
    iMain = Forms!frmMainLink.Form.MainID
    
If Me.NewRecord = True Then
    If MsgBox("Do you want to create a new record linked to the current ID?", vbYesNo + vbExclamation + vbDefaultButton2, "WARNING") = vbYes Then
    Me.MainFK = iMain
    Me.Caption = "New Record"
    End If
Else
     Me.Caption = Forms!frmMainLink.Form.CusName
End If
 

Attachments

Users who are viewing this thread

Back
Top Bottom