开发者

How would I have a MS Access form come up with certain fields pre-populated from the previous form?

Basically I just need the id of the record on the first form so I can stick it in the foreign key column of the record on t开发者_高级运维he second form. How do I pass this information along? Please ask for clarification in comments if this is not enough information.


If the first form calls the second form, then you can create a function that has as a parameter the object you want to pass in. Then after form creation, call the function.

Below is some psuedo code to demonstrate the calling of the new form and sending of the needed data.

public sub OnClick() {
  Form2 frm = new Form2
  frm.Initialize( recordId )
  frm.Show
}


The OpenForm method of DoCmd has both a where argument and an OpenArgs argument. OpenArgs is likely to suit.

 DoCmd.OpenForm "FormName",,,,,, Me.ID

It is also possible to get the information from an open form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜