aziz rasul
Active member
- Local time
- Today, 15:38
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have the following code in a module.
Public Sub Zero(FormName As String)
Dim cntcbo As Control
Dim cnttxt As Control
Dim i As String
For Each cntcbo In Forms!frmPatientInformation.Controls
If cntcbo.ControlType = acComboBox And Left(cntcbo.Name, 8) = "cboItems" Then
i = Mid(cntcbo.Name, 9, 2)
For Each cnttxt In Forms!frmPatientInformation.Controls
If cnttxt.ControlType = acTextBox And Left(cnttxt.Name, 10) = "txtItems" & i Then
If IsNull(cntcbo) And cnttxt <> 0 Or IsNull(cnttxt) Then
cnttxt = 0
Else
Exit For
End If
End If
Next cnttxt
End If
Next cntcbo
End Sub
How do I pass the FormName into the bit that is in bold?
Public Sub Zero(FormName As String)
Dim cntcbo As Control
Dim cnttxt As Control
Dim i As String
For Each cntcbo In Forms!frmPatientInformation.Controls
If cntcbo.ControlType = acComboBox And Left(cntcbo.Name, 8) = "cboItems" Then
i = Mid(cntcbo.Name, 9, 2)
For Each cnttxt In Forms!frmPatientInformation.Controls
If cnttxt.ControlType = acTextBox And Left(cnttxt.Name, 10) = "txtItems" & i Then
If IsNull(cntcbo) And cnttxt <> 0 Or IsNull(cnttxt) Then
cnttxt = 0
Else
Exit For
End If
End If
Next cnttxt
End If
Next cntcbo
End Sub
How do I pass the FormName into the bit that is in bold?