Dos "private sub"
Buenas tardes,
¿Puedo poner una Private Sub dentro de otra?
En un formulario tengo evento que "al activar registro" busca un registro concreto. El código es éste:
Private Sub Form_Current()
Dim vExp As Long
Dim vDef As Long
Dim vDefDescr As String
vExp = Nz(Me.id_expedient.Value, 0)
If vExp = 0 Then
Me.txtDefinicio.Value = Null
Exit Sub
End If
vDef = DLookup("[materia]", "1 assumptes", "[id_expedient]=" & vExp)
vDefDescrip = DLookup("[materia]", "materia", "[Id-materia]=" & vDef)
Me.txtDefinicio.Value = vDefDescrip
Pero me gustaría que un campo dentro de ese mismo formulario mostrara el fondo amarillo en el supuesto de contener información. El código sería éste:
Private Sub Form_Current()
With Me
If Not IsNull(Me.datarxiu.Value) Then
.datarxiu.BackStyle = 1
.datarxiu.BackColor = vbYellow
Else
.datarxiu.BackStyle = 0
End If
End With
End Sub
La cuestión es si pueden convivir, y cómo, estos dos Private Sub Form juntos. ¿Es posible?
Gracias