Friends I met with a problem...Please help

I have a table 'Tran' in Access Database which has several fields of which one is 'Date'
I added several records through programm on different dates.Everything OK. All the records appeared in a chronological way ie.Earlier to Later order . Later I deleted some earlier records randomly.(Not through programm but manually).Now when I try to add record through programm the 'Date' order is not retained. I think the new added record takes the place of the deleted record.It will affect the output of the programme.Is there any way to maintain the chronological order in the records of the table. My relevant code is given below.

     TRS.AddNew
     TRS("Ac") = TxtAc.Text
     TRS("Acno") = TxtAcno.Text
     TRS("Name") = TxtName.Text
     TRS("Date") = TxtDate.Text
     TRS("Tramt") = TxtTramt.Text
     TRS("Type") = TxtType.Text
     TRS("Details") = TxtDetails.Text
     TRS("Vdate") = TxtVdate.Text
     TRS("Ac") = TxtAc.Text
     TRS("Cq") = TxtCq.Text
     TRS("Part") = "."
     TRS("Uid") = UID
     TRS("Mid") = UID
     TRS("Edt") = Format$(Date, "dd/mm/yyyy")
     TRS("Mdt") = Format$(Date, "dd/mm/yyyy")
     TRS("Trnno") = TN

        If TxtType.Text = "C" Then
      TRS("Credit") = TxtTramt.Text
      TRS("Debit") = 0
      TRS("Dc") = "CR"
          Else
       If TxtType.Text = "D" Then
      TRS("Debit") = TxtTramt.Text
      TRS("Credit") = 0
      TRS("Dc") = "DR"
          End If
          End If

       If LblCd = "CR" And TRS("Dc") = "CR" Then
     TRS("Balance") = PB + Val(TxtTramt.Text)
          Else
        If LblCd = "CR" And TRS("Dc") = "DR" Then
     TRS("Balance") = PB - Val(TxtTramt.Text)
          Else
       If LblCd = "DR" And TRS("Dc") = "DR" Then
     TRS("Balance") = PB - Val(TxtTramt.Text)
          Else
        If LblCd = "DR" And TRS("Dc") = "CR" Then
     TRS("Balance") = PB + Val(TxtTramt.Text)
        End If
         End If
          End If
           End If

      If LblCd = "CR" And TRS("Balance") >= 0 Then
      TRS("Cd") = "CR"
        Else
     If LblCd = "CR" And TRS("Balance") < 0 Then
       TRS("Cd") = "DR"
       Else
     If LblCd = "DR" And TRS("Balance") >= 0 Then
      TRS("Cd") = "CR"
        Else
     If LblCd = "DR" And TRS("Balance") < 0 Then
       TRS("Cd") = "DR"
        End If
         End If
          End If
           End If
     LblEuid = UID
     LblMuid = UID
     LblEdt = Format$(Date, "dd/mm/yyyy")
     LblMdt = Format$(Date, "dd/mm/yyyy")
     LblDC = TRS("Cd")
     LblBalance = TRS("Balance")
     TxtTrno = TRS("Trnno")
    TRS.Update
    TRS.Requery

I want always the records in a date wise order- earlier to later

You can specify the sort order when you retrieve the records by using the ORDER BY clause in the query.

SELECT * FROM mytable ORDER BY fieldname

OK thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.