Still having problems re-populating our datarepeater with a new search. The repeater still reads the previous search unless you re-enter the program. I have attaced the code (Please remember that there are several iterations here, so it's not as clean as the final product will be).
Private Sub cmdNewVisit_Click()
If inputNurse > " " Then GoTo ContNewVisit
inputNurse = InputBox$("Treating Nurse Initials", "EMS", , 1000, 1000)
ContNewVisit:
Dim strBookmark As String
Dim sin2468 As String
Dim sum2468 As Integer
Dim sin1357 As Integer
Dim sinWrk As Integer
Dim sinsum As Integer
Dim intUserResponse As Integer
Dim strNewVisit As String
Dim buttonpressed As Variant
Dim i As Variant
Dim sinWork As String * 9
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim prm As New ADODB.Parameter
Dim drView As Variant
Dim Test As Long
Const conBtns As Integer = vbOKOnly + vbExclamation
dgType.Visible = False
dgArea.Visible = False
dgDiagnosis.Visible = False
dgJob.Visible = False
dgCause.Visible = False
dgTreatment.Visible = False
dgSide.Visible = False
dgNew.Visible = False
dgWSIB.Visible = False
dgSafe.Visible = False
dgDept.Visible = False
dgZone.Visible = False
dgAction.Visible = False
dgMedRestCode.Visible = False
dgStatus.Visible = False
dgMedD8.Visible = False
' deMV.cnn.Open
' drpMedVisit.Enabled = False
cmdView.Visible = False
Start_over:
famEmpMasterInfo.Visible = False
drpMedVisit.Visible = False
framMedicalHeader.Visible = False
famRecMaint.Visible = False
famMessage.Visible = False
inputSINNo = InputBox$("SIN Number", "EMS", , 1000, 1000)
If Val(inputSINNo) < 1 Then Exit Sub
If Val(inputSINNo) < 100000000 Or Val(inputSINNo) > 999999999 Then
MsgBox "S.I.N. out of range", vbOKOnly + vbInformation
GoTo Start_over
End If
sin2468$ = Mid(inputSINNo, 2, 1) + Mid(inputSINNo, 4, 1) + Mid(inputSINNo, 6, 1) + Mid(inputSINNo, 8, 1)
sum2468% = Val(sin2468$) + Val(sin2468$)
sin2468$ = Str(sum2468)
sinWrk = 0
For i = 1 To Len(sin2468)
sinWrk = sinWrk + Val(Mid(sin2468$, i, 1))
Next i
sin1357% = sinWrk% + Val(Mid(inputSINNo, 1, 1)) + Val(Mid(inputSINNo, 3, 1)) + Val(Mid(inputSINNo, 5, 1)) + Val(Mid(inputSINNo, 7, 1))
sinsum = (Fix((sin1357% + 9) / 10)) * 10:
If Val(Right$(inputSINNo, 1)) <> sinsum% - sin1357% Then
buttonpressed = MsgBox(inputSINNo, 2, "this is NOT valid number"
GoTo Start_over
End If
With adoIRMaster.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find "SINNo='" & inputSINNo & "'"
If .EOF Then
MsgBox "Employee Not Found", vbOKOnly + vbInformation
GoTo Start_over
End If
End With
With adoMedAlert.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find "SINNo='" & inputSINNo & "'"
If .EOF Then
Exit Sub
End If
End With
famEmpMasterInfo.Visible = True
' deMV.cnn.Open
' With cmd
' .ActiveConnection = deMV.cnn
' .CommandText = "DROP TABLE MedTemp"
' On Error Resume Next
' .Execute
' End With
' deMV.cnn.Close
MsgBox "it's dropped"
txtIRMSINNo = inputSINNo
txtFields(0) = txtIRMSINNo
framMedicalHeader.Visible = True
With famMessage
.Top = 5880
.Visible = True
End With
deMV.cnn.Open
With cmd
.ActiveConnection = deMV.cnn
.CommandText = "SELECT * INTO MedTemp FROM MedVisits WHERE SINNo = ? ORDER BY TDate DESC"
.CommandType = adCmdText
End With
With drpMedVisit
' .Enabled = True
.Visible = True
.Refresh
End With
If adoMedVisits.EOFAction Then
MsgBox "No Medcial Record On File For This Employee"
End If
With prm
.Direction = adParamInput
.Type = adInteger
.Value = inputSINNo
End With
cmd.Parameters.Append prm
' Set rs = cmd.Execute
drpMedVisit.Refresh
deMV.cnn.Close
Set cnn = Nothing
End Sub
Private Sub cmdNewVisit_Click()
If inputNurse > " " Then GoTo ContNewVisit
inputNurse = InputBox$("Treating Nurse Initials", "EMS", , 1000, 1000)
ContNewVisit:
Dim strBookmark As String
Dim sin2468 As String
Dim sum2468 As Integer
Dim sin1357 As Integer
Dim sinWrk As Integer
Dim sinsum As Integer
Dim intUserResponse As Integer
Dim strNewVisit As String
Dim buttonpressed As Variant
Dim i As Variant
Dim sinWork As String * 9
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim prm As New ADODB.Parameter
Dim drView As Variant
Dim Test As Long
Const conBtns As Integer = vbOKOnly + vbExclamation
dgType.Visible = False
dgArea.Visible = False
dgDiagnosis.Visible = False
dgJob.Visible = False
dgCause.Visible = False
dgTreatment.Visible = False
dgSide.Visible = False
dgNew.Visible = False
dgWSIB.Visible = False
dgSafe.Visible = False
dgDept.Visible = False
dgZone.Visible = False
dgAction.Visible = False
dgMedRestCode.Visible = False
dgStatus.Visible = False
dgMedD8.Visible = False
' deMV.cnn.Open
' drpMedVisit.Enabled = False
cmdView.Visible = False
Start_over:
famEmpMasterInfo.Visible = False
drpMedVisit.Visible = False
framMedicalHeader.Visible = False
famRecMaint.Visible = False
famMessage.Visible = False
inputSINNo = InputBox$("SIN Number", "EMS", , 1000, 1000)
If Val(inputSINNo) < 1 Then Exit Sub
If Val(inputSINNo) < 100000000 Or Val(inputSINNo) > 999999999 Then
MsgBox "S.I.N. out of range", vbOKOnly + vbInformation
GoTo Start_over
End If
sin2468$ = Mid(inputSINNo, 2, 1) + Mid(inputSINNo, 4, 1) + Mid(inputSINNo, 6, 1) + Mid(inputSINNo, 8, 1)
sum2468% = Val(sin2468$) + Val(sin2468$)
sin2468$ = Str(sum2468)
sinWrk = 0
For i = 1 To Len(sin2468)
sinWrk = sinWrk + Val(Mid(sin2468$, i, 1))
Next i
sin1357% = sinWrk% + Val(Mid(inputSINNo, 1, 1)) + Val(Mid(inputSINNo, 3, 1)) + Val(Mid(inputSINNo, 5, 1)) + Val(Mid(inputSINNo, 7, 1))
sinsum = (Fix((sin1357% + 9) / 10)) * 10:
If Val(Right$(inputSINNo, 1)) <> sinsum% - sin1357% Then
buttonpressed = MsgBox(inputSINNo, 2, "this is NOT valid number"
GoTo Start_over
End If
With adoIRMaster.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find "SINNo='" & inputSINNo & "'"
If .EOF Then
MsgBox "Employee Not Found", vbOKOnly + vbInformation
GoTo Start_over
End If
End With
With adoMedAlert.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find "SINNo='" & inputSINNo & "'"
If .EOF Then
Exit Sub
End If
End With
famEmpMasterInfo.Visible = True
' deMV.cnn.Open
' With cmd
' .ActiveConnection = deMV.cnn
' .CommandText = "DROP TABLE MedTemp"
' On Error Resume Next
' .Execute
' End With
' deMV.cnn.Close
MsgBox "it's dropped"
txtIRMSINNo = inputSINNo
txtFields(0) = txtIRMSINNo
framMedicalHeader.Visible = True
With famMessage
.Top = 5880
.Visible = True
End With
deMV.cnn.Open
With cmd
.ActiveConnection = deMV.cnn
.CommandText = "SELECT * INTO MedTemp FROM MedVisits WHERE SINNo = ? ORDER BY TDate DESC"
.CommandType = adCmdText
End With
With drpMedVisit
' .Enabled = True
.Visible = True
.Refresh
End With
If adoMedVisits.EOFAction Then
MsgBox "No Medcial Record On File For This Employee"
End If
With prm
.Direction = adParamInput
.Type = adInteger
.Value = inputSINNo
End With
cmd.Parameters.Append prm
' Set rs = cmd.Execute
drpMedVisit.Refresh
deMV.cnn.Close
Set cnn = Nothing
End Sub