Hi,
I have the next code to show me a form by apellidos (last name). I mean I write the last name and then I click the command button OK to show me a form with that last name.
Private Sub cboApellidos_AfterUpdate()
' Buscar el registro que coincida con el control.
Me.RecordsetClone.FindFirst "[Apellidos] = '" & Me![cboApellidos] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Private Sub cmdbusqapellidos_Click()
On Error GoTo Err_cmdbusqapellidos_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmUsuarios"
stLinkCriteria = "[Apellidos]='" & Me![Apellidos] & "'"
' DoCmd.Close
' DoCmd.OpenForm stDocName, , , stLinkCriteria
If IsNull([cboApellidos]) = True Then
MsgBox (" Debe introducir un apellido")
Else
'DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_cmdbusqapellidos_Click:
Exit Sub
Err_cmdbusqapellidos_Click:
MsgBox Err.Description
Resume Exit_cmdbusqapellidos_Click
End Sub
The problema is that it works sometimes. Normally it shows up the same last name. Can anyone help me?
Thanks a lot.
I have the next code to show me a form by apellidos (last name). I mean I write the last name and then I click the command button OK to show me a form with that last name.
Private Sub cboApellidos_AfterUpdate()
' Buscar el registro que coincida con el control.
Me.RecordsetClone.FindFirst "[Apellidos] = '" & Me![cboApellidos] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Private Sub cmdbusqapellidos_Click()
On Error GoTo Err_cmdbusqapellidos_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmUsuarios"
stLinkCriteria = "[Apellidos]='" & Me![Apellidos] & "'"
' DoCmd.Close
' DoCmd.OpenForm stDocName, , , stLinkCriteria
If IsNull([cboApellidos]) = True Then
MsgBox (" Debe introducir un apellido")
Else
'DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_cmdbusqapellidos_Click:
Exit Sub
Err_cmdbusqapellidos_Click:
MsgBox Err.Description
Resume Exit_cmdbusqapellidos_Click
End Sub
The problema is that it works sometimes. Normally it shows up the same last name. Can anyone help me?
Thanks a lot.