Results 1 to 9 of 9

Thread: [RESOLVED] how do display the last customers entry

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] how do display the last customers entry

    hello everyone
    i have a database with customers that i add each day
    im trying to figure out how to see the new entries that i add in the same day
    how many customers i added in the same day
    like a report or something like that
    i need a idea where to start this
    regards salsa

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: how do display the last customers entry

    It would be easy if you have a timestamp field
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how do display the last customers entry

    what do you meen?

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: how do display the last customers entry

    Salsa

    I think that Jggtz is suggesting that you add a field to your database
    Then, each time a new record is added, also populate said field with the date it was added.

    Subsequently, you could create an SQL statement to select only those records that match,
    say, today's date.

    Spoo

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how do display the last customers entry

    this is the save button when i add the customer to the listview and save him in the DB
    Code:
    Private Sub SaveCust()
    If Len(Trim$(Txt(1).Text)) = 0 Then
            MsgBox "name cant be empty", vbExclamation, "  "
            Txt(1).SetFocus
            Exit Sub
        Else
            Set RS = CN.Execute("SELECT * FROM Customers WHERE FullName='" & RplS(Txt(1).Text) & "'")
            If Not RS.EOF Then
                MsgBox "ì÷åç æä ëáø ÷ééí áîòøëú", vbExclamation, RS!FullName
                Txt(1).SetFocus
                Exit Sub
            End If
        End If
             If Len(Trim$(Txt(2).Text)) = 0 Then
            MsgBox "this customer already in the database", vbExclamation, "ùãåú çåáä"
            Txt(2).SetFocus
            Exit Sub
        End If
        
            If Len(Trim$(Txt(5).Text)) = 0 Then
            MsgBox "fields missing", vbExclamation
            Txt(5).SetFocus
            Exit Sub
        End If
            If Len(Trim$(Txt(7).Text)) = 0 Then
            MsgBox "fields missing", vbExclamation
            Txt(7).SetFocus
            Exit Sub
        End If
        If BttnPhoto.Picture = 0 Then
        MsgBox "fields missing", vbInformation
        Exit Sub
        End If
        
        Dim NewID As Long
        NewID = NextID("ID", "Customers")
        CN.Execute "INSERT INTO Customers (ID, FullName, Address, DateBirth, Facebook, Email, Phone, Cellular, HairColour, Oxygen, Photo) VALUES (" & _
            NewID & ", '" & _
            RplS(Txt(1).Text) & "', '" & _
            RplS(Txt(2).Text) & "', #" & _
            MyDate(PckBirth.Value) & "#, '" & _
            RplS(Txt(4).Text) & "', '" & _
            RplS(Txt(5).Text) & "', '" & _
            RplS(Txt(6).Text) & "', '" & _
            RplS(Txt(7).Text) & "', '" & _
            RplS(Txt(8).Text) & "', '" & _
            CmbOxygen.Text & "', '" & _
            CmmDlg.FileName & "')"
            
            
    
        Set Itm = LsVw.ListItems.Add(, , Txt(1).Text, , "cust")
        Itm.Tag = NewID
        Itm.Bold = True
        Itm.SubItems(1) = Txt(2).Text
        Itm.SubItems(2) = Format(PckBirth.Value, "dd/mm/yyyy")
        Itm.SubItems(3) = Txt(4).Text
        Itm.SubItems(4) = Txt(5).Text
        Itm.SubItems(5) = Txt(6).Text
        Itm.SubItems(6) = Txt(7).Text
        Itm.SubItems(7) = Txt(8).Text
        Itm.SubItems(8) = CmbOxygen.Text
        Set BttnPhoto.Picture = LoadPicture(CmmDlg.FileName)
        Itm.EnsureVisible
        Itm.Selected = True
        StBar.Panels(2) = Format(LsVw.ListItems.Count, "#,###0")
    
        If ChkRepeat.Value Then
            ClearDetails
            Txt(1).SetFocus
             Set BttnPhoto.Picture = Nothing
            Exit Sub
        End If
        TmrClose.Enabled = True

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how do display the last customers entry

    i never done this before a little help will be nice
    hey spoo i need this to be saved in a clean DB

  7. #7

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how do display the last customers entry

    anybody?

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: how do display the last customers entry

    salsa31....
    simply add a field in your DB (as suggested earlier), then, in your insert command, include that field and insert today's DATE (just like you did the DOB insert).
    Then, to see who was ADDED on any given day, simply do a select statement. (You could use a datepicker control for the user to select any given date) If return is zero, don't do anything, but if greater than zero, display the info in a listbox (for example). Seems you have the knowledge of using the db okay, so you should have no problem doing this. If you do, post your attempt to 1, add the date to the db, and 2, retrieving by date.

  9. #9

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how do display the last customers entry

    ill try tnk you all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width