Hi
I'll try and explain my problem as best as possible. I have a workproduct form that allows you to select an ID, once the ID is selected, theres a button that you can click to enter in defects to this workproduct. On the defect form, the workProductID is auto filled with what ever ID you selected on the work product form (i.e. if you selected work product ID 0045 on the work product form and clicked the 'defect' button, then on the defect form, the work product ID will appear as 0045 which is great). Now my question is, when you select 'next defect', i want that workproduct ID carried forward to the next record and displayed on the form.The tables are linked together with a one-to-many relationship (one - workproduct, many - defects).
I have the code which does this when you press a toggle button, but my VB isnt good enough to work out how to do this without a toggle button (i.e. on the form load). Heres the code i found from an Access book.
with this on the onclick event of the toggle button:
Any ideas?
Thanks in advance
I'll try and explain my problem as best as possible. I have a workproduct form that allows you to select an ID, once the ID is selected, theres a button that you can click to enter in defects to this workproduct. On the defect form, the workProductID is auto filled with what ever ID you selected on the work product form (i.e. if you selected work product ID 0045 on the work product form and clicked the 'defect' button, then on the defect form, the work product ID will appear as 0045 which is great). Now my question is, when you select 'next defect', i want that workproduct ID carried forward to the next record and displayed on the form.The tables are linked together with a one-to-many relationship (one - workproduct, many - defects).
I have the code which does this when you press a toggle button, but my VB isnt good enough to work out how to do this without a toggle button (i.e. on the form load). Heres the code i found from an Access book.
Code:
Public Function acbCarry(frm As Form, ctlToggle As Control)
Dim ctlData As Control
Const acbcQuote = """"
Set ctlData = frm(ctlToggle.Tag)
If ctlToggle.Value Then
If Len(ctlData.DefaultValue) > 0 Then
ctlData.Tag = ctlData.DefaultValue
End If
ctlData.DefaultValue = acbcQuote & ctlData.Value & acbcQuote
Else
If Len(ctlData.Tag) > 0 Then
ctlData.DefaultValue = ctlData.Tag
ctlData.Tag = ""
Else
ctlData.DefaultValue = ""
End If
End If
End Function
with this on the onclick event of the toggle button:
Code:
=acbCarry([Form],[Screen].[ActiveControl])
Any ideas?
Thanks in advance