By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,870 Members | 2,484 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,870 IT Pros & Developers. It's quick & easy.

Update a form from another form

P: 19
Hi, I have been working on a purchase order form and am trying to add something to it. I currently have a form frmPurchaseOrder and it has 3 tabs in it called header, detail select and detail update. I have a combo box in the detail select tab that allows me to select data from a requisition table "tblRequistion" by requistion number so the user doesn't have re-enter all the information again and that populates the form in a datasheet view. I would like to be able to put in a command button to throw the forms view over to the detail update tab in an append datasheet so that the user can add multiple requistions and add the addtional entries before updating the purchase order table. Can this be done from one form to another? I cannot make it work not matter what i've tried..
Thanks Mark.
Mar 4 '07 #1
Share this Question
Share on Google+
5 Replies


ADezii
Expert 5K+
P: 8,637
Hi, I have been working on a purchase order form and am trying to add something to it. I currently have a form frmPurchaseOrder and it has 3 tabs in it called header, detail select and detail update. I have a combo box in the detail select tab that allows me to select data from a requisition table "tblRequistion" by requistion number so the user doesn't have re-enter all the information again and that populates the form in a datasheet view. I would like to be able to put in a command button to throw the forms view over to the detail update tab in an append datasheet so that the user can add multiple requistions and add the addtional entries before updating the purchase order table. Can this be done from one form to another? I cannot make it work not matter what i've tried..
Thanks Mark.
To make the detail update Tab the Active Tab, and then to explicitly shift Focus to the Sub-Form contained within that Tab:
Expand|Select|Wrap|Line Numbers
  1. Me!your Tab Control name.Pages(2).SetFocus           '3rd Tab
  2. Me![your Sub-Form control name].SetFocus
Mar 5 '07 #2

P: 19
To make the detail update Tab the Active Tab, and then to explicitly shift Focus to the Sub-Form contained within that Tab:
Expand|Select|Wrap|Line Numbers
  1. Me!your Tab Control name.Pages(2).SetFocus           '3rd Tab
  2. Me![your Sub-Form control name].SetFocus
Thanks for the response. I still can't get it. I set the on click event of the button as follows:

Private Sub AddItemsToPO__DetailsUpdate_Click()
Me!TabCtl16.Pages(2).SetFocus '3rd Tab
Me![frmPurchaseOrderDetailUpdate].SetFocus
End Sub

I get a run error message; "Can't find the field TabCtl16 referred to in your expression"

I aplogize for the lack of understanding here, but forms are my real weak spot. Assuming this would work, how does the information feed to the update form? Would I not have to add addtional coding to append the data?

Thanks Mark.
Mar 5 '07 #3

P: 19
Thanks for the response. I still can't get it. I set the on click event of the button as follows:

Private Sub AddItemsToPO__DetailsUpdate_Click()
Me!TabCtl16.Pages(2).SetFocus '3rd Tab
Me![frmPurchaseOrderDetailUpdate].SetFocus
End Sub

I get a run error message; "Can't find the field TabCtl16 referred to in your expression"

I aplogize for the lack of understanding here, but forms are my real weak spot. Assuming this would work, how does the information feed to the update form? Would I not have to add addtional coding to append the data?

Thanks Mark.
Anyone able to help with this? I am really stuck now.
Mar 6 '07 #4

ADezii
Expert 5K+
P: 8,637
Anyone able to help with this? I am really stuck now.
You may be referencing the wrong Index into the Pages Collection - remember they start at 0 so the 1st Tab would have a value of 0, the 2nd 1, etc. Collections will not automatically adjust their Elements if a Tab should be deleted, etc. To be sure, place the following code in the Change() Event of the Tab Control, then Click on your Tab. If it is not 2 then change the line in the 2nd Code example:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TabCtl16_Change()
  2. On Error GoTo Err_TabCtl16_Change   ' <R22>
  3.   MsgBox Me!TabCtl16.Value
  4. End Sub
Expand|Select|Wrap|Line Numbers
  1. Me!TabCtl16.Pages(<value returned from Msgbox>).SetFocus
If this doesn't work, check for a typo in either the Sub-Form name or the Tab Control name.
Mar 6 '07 #5

P: 19
You may be referencing the wrong Index into the Pages Collection - remember they start at 0 so the 1st Tab would have a value of 0, the 2nd 1, etc. Collections will not automatically adjust their Elements if a Tab should be deleted, etc. To be sure, place the following code in the Change() Event of the Tab Control, then Click on your Tab. If it is not 2 then change the line in the 2nd Code example:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TabCtl16_Change()
  2. On Error GoTo Err_TabCtl16_Change   ' <R22>
  3.   MsgBox Me!TabCtl16.Value
  4. End Sub
Expand|Select|Wrap|Line Numbers
  1. Me!TabCtl16.Pages(<value returned from Msgbox>).SetFocus
If this doesn't work, check for a typo in either the Sub-Form name or the Tab Control name.

Thanks for the reply. I appreciate your help so far, everyone in this forum are great! I still cn't lick this stuppid thing, I am going to tear it down and redesign the update forms..
Mar 7 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.