Start New Discussion within our Software Development Community

So I've FINALLY gotten my code to work but unfortunately my code's sooo messed up that its displaying something else!
As you can see in the picture below, the Flex Grid is displaying the data of "Service"

When its actually supposed to show the data of "Receipt Service"!

I just need help in finding out that what code is responsible for doing all this, so that i can make changes to it.

Heres my code:

 Private Sub Form_Load()
    Set connS = New ADODB.Connection
    Set RSservice = New ADODB.Recordset
    Set RSPartPayment = New ADODB.Recordset
    Set RSReceipt = New ADODB.Recordset
    Set RSReceiptService = New ADODB.Recordset

    connS.ConnectionString = "Provider=Microsoft.Jet.OlEDB.4.0;Data Source=" & App.Path & _
    "\ParlourDesign.mdb;Persist Security Info=False"

    SQLReceiptService = "select * from ReceiptService"
    SQLservice = "select * from Service"
    SQLPartPayment = "select * from PartPayment"
    SQLReceipt = "select * from Receipt"

    RSservice.CursorLocation = adUseClient
    RSPartPayment.CursorLocation = adUseClient
    RSReceipt.CursorLocation = adUseClient
    RSReceiptService.CursorLocation = adUseClient

    RSReceiptService.Open (SQLReceiptService), connS, adOpenDynamic, adLockOptimistic
    RSservice.Open (SQLservice), connS, adOpenDynamic, adLockOptimistic
    RSPartPayment.Open (SQLPartPayment), connS, adOpenDynamic, adLockOptimistic
    RSReceipt.Open (SQLReceipt), connS, adOpenDynamic, adLockOptimistic


    Call updateScr
    Call updGrd

    Do While Not RSReceiptService.EOF
    cmbreceipt.AddItem RSReceiptService.Fields(1)

End Sub

Private Sub flexreceipt_Click()
 Select Case FlexReceipt.Col
        Case 6: chkSelect.Visible = True
                chkSelect.Left = FlexReceipt.Left + FlexReceipt.CellLeft
                chkSelect.Top = FlexReceipt.Top + FlexReceipt.CellTop
                If FlexReceipt.Text = "Selected" Then
                    chkSelect.Value = "1"
                    chkSelect.Value = "0"
                End If
                chkSelect.Visible = True
        lrow = FlexReceipt.Row
        lcol = FlexReceipt.Col
    End Select
End Sub

Private Sub flexreceipt_DblClick()
Select Case FlexReceipt.Col
Case 0, 6: 'Receipt No
    Exit Sub
Case 1, 3, 5: 'Text Boxes
            GridEdit Asc(" ")

Case 2: 'cmbreceipt
            cmbreceipt.Left = FlexReceipt.CellLeft + FlexReceipt.Left
            cmbreceipt.Top = FlexReceipt.CellTop + FlexReceipt.Top
            cmbreceipt.Width = FlexReceipt.CellWidth
            cmbreceipt.Visible = True
            cmbreceipt.Text = FlexReceipt.TextMatrix(FlexReceipt.Row, FlexReceipt.Col)
End Select
End Sub

Private Sub updGrd()

Dim RR As Integer

SQLReceiptService = "select * from ReceiptService Where Service = " & txtreceiptno
RSReceiptService.Open (SQLReceiptService), connS, adOpenDynamic, adLockOptimistic

FlexReceipt.Rows = IIf(RSReceiptService.RecordCount < 0, 1, RSReceiptService.RecordCount + 1)
FlexReceipt.Cols = RSReceiptService.Fields.count - 1
FlexReceipt.FixedCols = 0
FlexReceipt.TextMatrix(0, 0) = "Service"

If RSReceiptService.EOF Then Exit Sub
RR = 1
Do While Not RSReceiptService.EOF()

    FlexReceipt.TextMatrix(RR, 0) = Service(RSReceiptService.Fields(1))
    RR = RR + 1
End Sub

Function ServiceName(Tname As String) As Integer
Do While Not RSservice.EOF
    If RSservice.Fields(1) = Tname Then
        ServiceName = RSservice.Fields(0)
        Exit Do
    End If
End Function

Function Service(TID As Integer) As String
Do While Not RSservice.EOF
    If RSservice.Fields(0) = TID Then
        Service = RSservice.Fields(1)
        Exit Do
    End If
End Function

Private Sub updateScr()
If RSReceipt.EOF = True Or RSReceipt.BOF = True Then Exit Sub

If Not IsNull(RSReceipt.Fields(0)) Then
    txtreceiptno = RSReceipt.Fields(0)
End If

txtcustomer = IIf(Not IsNull(RSReceipt.Fields(1)), RSReceipt.Fields(1), "No Name")
txttotalamount = IIf(Not IsNull(RSReceipt.Fields(3)), RSReceipt.Fields(3), "No Amount")
End Sub

So how do I make "Receipt Service"s data show instead of "Service"?
Theres code for all the buttons too, but I'm sure that has got nothing to do with this...

Oh, and an other question! WHY is the date being displayed in the "Customer" field when its actually suppose to display the customers name!? :\

Thanks in Advance! :)

This part is incorrect, change code -

SQLReceiptService = "select * from ReceiptService Where Service = " & txtreceiptno

SQLReceiptService = "select * from ReceiptService Where Service = '" & txtreceiptno & "'"
This question has already been answered. Start a new discussion instead.