Lost data

cjaymcmeans

Well-known member
Joined
Jan 12, 2005
Messages
85
Programming Experience
3-5
hey guys..
i made to forms a data form(formX) and a search form(formS) for formX
basically formS can only be accessed if formX is active...

my problem is that after i choose a control number from formS and pass it to formX the datatables in formX somehow gets erased...

i dont know why it happens but i need some help as to why it happens and how to go around it.. :D

tnx..
 
ok..
this event gets the records reference number and passes it on to the frmlogbook for population....

Private
Sub txtITRSearch_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtITRSearch.KeyPress
Dim Str1 As String
Dim frm As New frmLogbook (form to be ppopulated)
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) And dbgsearch.VisibleRowCount > 0Then
Str1 = dbgsearch.Item(0, 0).ToString
Frm.txtITRNo.Text = Str1
Me.Close()
End If
End Sub


this sub populates the frmlogbook, all the datatable have been declared properly and have been assigned values on form load...

basically its a common form interaction much like in vb6.. wherein you go to a form search for a record then after finding it you'll see the details in your primary form...

but the problem is that after finding the record in the search form.. and passsing it to frmlogbook, the datatables in the said form seemed to have lost their values....
hope you can help...
tnx..

Public
Sub FillRequest(ByVal Rno As String)
Dim RequestRow, ITRDescRow As DataRow

Dim ModsRow, UserRow As DataRow

Dim DeptRow, SectRow, SectGrpRow, RecRow As DataRow

Dim SysRow, SysActRows(), SysActRow As DataRow

Dim MyStr As String

RequestRow = TblITR.Select("ITReqRefNum='" & Rno & "'")(0)

ITRDescRow = TblITRDesc.Select("itreqrefnum='" & Rno & "'")(0)

SysRow = TblSysLog.Select("itreqrefnum='" & Rno & "'")(0)

SysActRows = TblSysLogAct.Select("itreqrefnum='" & Rno & "'")

UserRow = TblUsers.Select("userid='" & Trim(RequestRow.Item("userid").ToString) & "'")(0)

lvwActions.Items.Clear()

txtITRNo.Text = Rno

txtUserName.Text = "" & Trim(UserNames(RequestRow.Item("userid").ToString))

txtTranDate.Text = RequestRow.Item("transactiondate").ToString

txtReqDate.Text = RequestRow.Item("requestdate").ToString

txtApproveBy.Text = UserNames(Trim(RequestRow.Item("endorsedby").ToString))

txtApproveDate.Text = RequestRow.Item("endorseddate").ToString

txtRemarks1.Text = "" & Trim(RequestRow.Item("endorsedbyremarks").ToString)



DeptRow = TblDept.Select("departmentcode='" & Trim(UserRow.Item("departmentcode").ToString) & "' and companycode='" & Trim(UserRow.Item("companycode").ToString) & "'")(0)

SectRow = TblSect.Select("sectioncode='" & Trim(UserRow.Item("sectioncode").ToString & "' and departmentcode='" & Trim(UserRow.Item("departmentcode").ToString & "' and companycode='" & Trim(UserRow.Item("companycode").ToString) & "'")))(0)

SectGrpRow = TblSectGrp.Select("sectgroupcode='" & Trim(UserRow.Item("sectgroupcode").ToString & "' and sectioncode='" & Trim(UserRow.Item("sectioncode").ToString & "' and departmentcode='" & Trim(UserRow.Item("departmentcode").ToString & "' and companycode='" & Trim(UserRow.Item("companycode").ToString) & "'"))))(0)

MyStr = "" & Trim(DeptRow.Item("departmentname").ToString) & " - " & Trim(SectRow.Item("sectionname").ToString) & " - " & Trim(SectGrpRow.Item("sectgroupname").ToString)

txtDept.Text = MyStr

txtlocation.Text = RequestRow.Item("location").ToString

txtcontact.Text = RequestRow.Item("contactnumber").ToString

txtPCID.Text = RequestRow.Item("computerid").ToString



lbxRequest.Items.Clear()

If UCase(Trim(RequestRow.Item("requesttype").ToString)) = "A" Then

lblRtype.Text = "System"

If UCase(Trim(RequestRow.Item("systemerror").ToString)) = "Y" Then

lbxRequest.Items.Add("System Error")

End If

If UCase(Trim(RequestRow.Item("systemenhancement").ToString)) = "Y" Then

lbxRequest.Items.Add("System Enhancement")

End If

If UCase(Trim(RequestRow.Item("addonmodule").ToString)) = "Y" Then

lbxRequest.Items.Add("Add on module")

End If

If UCase(Trim(RequestRow.Item("newsystem").ToString)) = "Y" Then

lbxRequest.Items.Add("New System")

End If

If UCase(Trim(RequestRow.Item("usertraining").ToString)) = "Y" Then

lbxRequest.Items.Add("usertraining")

End If

Else

lblRtype.Text = "Technical"

If UCase(Trim(RequestRow.Item("repair").ToString)) = "Y" Then

lbxRequest.Items.Add("Repair")

End If

If UCase(Trim(RequestRow.Item("upgrade").ToString)) = "Y" Then

lbxRequest.Items.Add("Upgrade")

End If

If UCase(Trim(RequestRow.Item("preventivemaint").ToString)) = "Y" Then

lbxRequest.Items.Add("Preventive Maintenace")

End If

If UCase(Trim(RequestRow.Item("installation").ToString)) = "Y" Then

lbxRequest.Items.Add("Installation")

End If

End If

If Not (RequestRow.IsNull("otherrequest")) Or Trim(RequestRow.Item("otherrequest").ToString) <> "" Then

txtRequestOthers.Text = Trim(RequestRow.Item("otherrequest").ToString)

Else

txtRequestOthers.Clear()

End If

MyStr = "" & UCase(Trim(RequestRow.Item("userurgency").ToString))

Select Case MyStr

Case "I"

txtUserUrgency.Text = "Immediate Action Needed"

Case "N"

txtUserUrgency.Text = "Handle Normal Priority"

Case "D"

txtUserUrgency.Text = "Defer Until Previously Request System is Developed"

Case Else

txtUserUrgency.Text = "Other Urgency"

txtOtherUrgency.Text = Trim(RequestRow.Item("userotherurgency").ToString)

End Select

' you stopped at the itrdesc...

txtAppName.Text = "" & AppsName(Trim(ITRDescRow.Item("applicationcode").ToString))

txtModName.Text = "" & ModsName(Trim(ITRDescRow.Item("modulecode").ToString))

txtExpectDate.Text = RequestRow.Item("expecteddate").ToString
RTBProblem.Text = "" & ITRDescRow.Item("backgroundinfo").ToString
RtbDetails.Text = "" & ITRDescRow.Item("details").ToString
rtbRecommend.Text = "" & RequestRow.Item("recommendedaction").ToString
cborecvBy.Text = "" & UserNames(Trim(RequestRow.Item("receivedby").ToString))
txtRec.Text = "" & RequestRow.Item("receiveddate").ToString & " " & RequestRow.Item("receivedtime").ToString
cboAssign.Text = "" & UserNames(RequestRow.Item("techassigned").ToString)
txtassigndate.Text = "" & RequestRow.Item("assigneddate").ToString
cboUrgency.Text = "" & RequestRow.Item("techurgency").ToString
cbocontact.Text = "" & UserNames(RequestRow.Item("contactuser").ToString)
If Not RequestRow.IsNull("techcomplexity") Then
Select Case UCase(Trim(RequestRow.Item("techcomplexity").ToString))
Case "L"
cboComplexity.Text = "Low"
Case "H"
cboComplexity.Text = "High"
Case "M"
cboComplexity.Text = "Medium"
End Select
End If
cboActStatus.Text = ""
cboRecstatus.Text = ""
txtActionRemarks.Text = "" & RequestRow.Item("statusremarks").ToString
txtRecRem.Text = "" & RequestRow.Item("statusremarks").ToString
txtstart.Text = "" & RequestRow.Item("projectschedfrom").ToString
txtend.Text = "" & RequestRow.Item("projectschedto").ToString
cborecBy.Text = "" & UserNames(RequestRow.Item("recommendedby").ToString)
DtpRec.Visible =
False
dtpRecommend.Visible = False
dtpConform.Visible = False
txtrecomDT.Text = "" & RequestRow.Item("recommendeddate").ToString & " - " &
RequestRow.Item("recommendedtime").ToString
txtconformDT.Text = "" & RequestRow.Item("conformeddate").ToString & " - " &
RequestRow.Item("conformedtime").ToString
cboconform.Text = "" & UserNames(RequestRow.Item("conformedby").ToString)
cborecvBy.Text = UserNames(RequestRow.Item("receivedby").ToString)
If Not SysRow.IsNull("ITReqrefnum") Then
Select Case SysRow.Item("scheduletype").ToString
Case "1"
cboSchedType.Text = "Regular Schedule"
Case "2"
cboSchedType.Text = "Maintenance"
End Select
cbodev1.Text = "" & UserNames(RequestRow.Item("servedby1").ToString)
cbodev2.Text = "" & UserNames(RequestRow.Item("servedby2").ToString)
cbodev3.Text = "" & UserNames(RequestRow.Item("servedby3").ToString)
dtpserved.Value =
CDate(RequestRow.Item("serveddate").ToString)
dtpInstall.Value = CDate(SysRow.Item("installationdate").ToString)
dtpCompletion.Value = CDate(SysRow.Item("completiondate").ToString)
dtpImp.Value = CDate(SysRow.Item("implementationdate").ToString)
txtAction.Text = Trim(SysRow.Item("actionsummary").ToString)
If SysActRows.Length > 0 Then
For Each SysActRow In SysActRows
lvwActions.Items.Add(SysActRow.Item("").ToString)
Next
End If
End If
End Sub
 
its all good now.. it was just a friendship problem.. hehehe..
just kidding but i've manage to solve it.. ei paszt tnx man...
 
Back
Top