G
grizfan
Guest
I have a master form (frmInspection) with multiple "defect" text boxes for different components on power poles. On click of each "defect" text box a pop-up form (frmDefects) appears with a list box containing 43 defects associated with the whole utility structure. Currently, my code will insert the id(s) of the defect(s) chosen into the text box that i specify (txtPoleDefect) separated by commas.
My problem is that i don't want to populate a specific text box, i want to populate the active textbox that what clicked on the master form. Below is my current code when "cmdSave" is clicked on "frmDefects":
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Dim I As Variant
Dim stNumber As String
Dim stComma As String
stNumber = "": stComma = ","
For Each I In Me!lstDefects.ItemsSelected
stNumber = stNumber & Me!lstDefects.ItemData(I)
stNumber = stNumber & stComma
Next I
stNumber = CStr(Left$(stNumber, Len(stNumber) - Len(stComma)))
Forms.frmInspection.txtPoleDefect = stNumber
DoCmd.Close
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub
Any help is greatly appreciated.
My problem is that i don't want to populate a specific text box, i want to populate the active textbox that what clicked on the master form. Below is my current code when "cmdSave" is clicked on "frmDefects":
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Dim I As Variant
Dim stNumber As String
Dim stComma As String
stNumber = "": stComma = ","
For Each I In Me!lstDefects.ItemsSelected
stNumber = stNumber & Me!lstDefects.ItemData(I)
stNumber = stNumber & stComma
Next I
stNumber = CStr(Left$(stNumber, Len(stNumber) - Len(stComma)))
Forms.frmInspection.txtPoleDefect = stNumber
DoCmd.Close
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub
Any help is greatly appreciated.