Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POPULATING DATAREPEATER ... ANYONE

Status
Not open for further replies.

fordman

Programmer
Aug 16, 2001
9
0
0
US
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 &quot;S.I.N. out of range&quot;, 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, &quot;this is NOT valid number&quot;)
GoTo Start_over
End If

With adoIRMaster.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find &quot;SINNo='&quot; & inputSINNo & &quot;'&quot;
If .EOF Then
MsgBox &quot;Employee Not Found&quot;, vbOKOnly + vbInformation
GoTo Start_over
End If
End With

With adoMedAlert.Recordset
.MoveFirst
strBookmark = .Bookmark
.Find &quot;SINNo='&quot; & inputSINNo & &quot;'&quot;
If .EOF Then
Exit Sub
End If
End With

famEmpMasterInfo.Visible = True

' deMV.cnn.Open
' With cmd
' .ActiveConnection = deMV.cnn
' .CommandText = &quot;DROP TABLE MedTemp&quot;
' On Error Resume Next
' .Execute
' End With
' deMV.cnn.Close

MsgBox &quot;it's dropped&quot;

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 = &quot;SELECT * INTO MedTemp FROM MedVisits WHERE SINNo = ? ORDER BY TDate DESC&quot;
.CommandType = adCmdText
End With

With drpMedVisit
' .Enabled = True
.Visible = True
.Refresh
End With

If adoMedVisits.EOFAction Then
MsgBox &quot;No Medcial Record On File For This Employee&quot;
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top