LisaP
12-08-2000, 03:35 AM
Help!
When entering order details onto a form [Orders] I have created a command button which opens form [Sub], both forms have an OrderID field. How can I get access to take the ID value and insert into into the field on the 2nd form. (N.B. the 1st form will remain current throughout).
Any advice gratefully appreciated.
Jack Cowley
12-08-2000, 06:34 AM
In the On Open event of the form that your Command button is opening you can use code similar to this:
[Forms]![SecondFormName]![ID] = [Forms]![FirstFormName]![ID]
Hope this is what you are after....
LisaP
12-15-2000, 06:23 AM
Jack,
Thanks for the response, but it hasnt helped!! Basically the situation has changed slightly - I have a continuous form which contains various orderID's details and has a command button to bring up a form (that has an orderID field) and allow users to update or add parts to an order. If the parts have already been ordered (through a different and will hopefully be obsolute method, if i can ever get this to work!) then the form will bring up the correct info, however if they havent, im getting a 0 in the orderID field instead of taking the OrderID value from the 1st form and pasting into the 2nd.
Have included the code below:-
Private Sub CmbPartsEng_Click()
On Error GoTo Err_CmbPartsEng_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PartsEng"
stLinkCriteria = "[CallNumber]=" & Me![CallNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmbPartsEng_Click:
Exit Sub
Err_CmbPartsEng_Click:
MsgBox Err.Description
Resume Exit_CmbPartsEng_Click
End Sub
Basically im stuck!
Ernie Taylor
12-15-2000, 07:01 AM
Although what you need is not totally clear. You could consider on your main form using a combobox for the orders and a subform linked to the parts list rather than using a separate form. My understanding is that you wish to look up an order and if it exists get a list of parts else create new order. This is very easy to do using the form/subform technique. Or am I missing the point? If I am missing the point consider using a filter rather than the code you are trying. Hope this helps
LisaP
12-18-2000, 04:58 AM
Thanks Ernie, sometimes you just cant see the wood for the trees! So easy when you think about it!