Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB & Database problem!!!!!!

  • 10-03-2004 07:58PM
    #1
    Closed Accounts Posts: 1,637 ✭✭✭


    Hy,

    Im trying to display using the FlexGrid Control only certain entries in a database,

    title.JPG

    Instead of all values I only want to display the ones with YES in the overdraft coloum.

    Heres the code to display all values.

    [PHP]

    Private Sub cmdShow_Click()

    If cmdShow.Caption = "Show Database" Then

    datCities.RecordSource = "SELECT Name, Accnumber FROM Cities"
    datCities.Refresh
    cmdShow.Caption = "Show Database"

    End If

    End Sub

    [/PHP]


    I Know it has something to do with this line

    [PHP]

    datCities.RecordSource = "SELECT Name, Accnumber FROM Cities"

    [/PHP]

    Thanks in advance

    joePC


Comments

  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    datCities.RecordSource = "SELECT Name, Accnumber FROM Cities WHERE overdraft = 'YES'" ?

    D.


  • Closed Accounts Posts: 1,637 ✭✭✭joePC


    I keep getting an error message, "Object Required",

    Anyone have any ideas,

    Thanks joePC


  • Closed Accounts Posts: 617 ✭✭✭LastIrishMonkey


    joe m8 im doing the same project for college atm i could email u my code and take a look at it ?:D


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Originally posted by joePC
    I keep getting an error message, "Object Required",

    Anyone have any ideas,

    Yeah. You need an object :)

    Seriously? If you're getting that error, you're not making the suggested change, or the code you posted originally doesn't work anyway for a completely seperate reason.

    If its the latter, I'd suggest you go back to what you showed us at the start and explain why thats not working as well....

    jc


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Originally posted by LastIrishMonkey
    joe m8 im doing the same project for college atm i could email u my code and take a look at it ?:D

    Thats a great way to learn how to code.

    Don't get me wrong....I hope you guys keep it up....it helps ensure that I'll never be out of a job.

    jc


  • Advertisement
  • Closed Accounts Posts: 1,637 ✭✭✭joePC


    OK got it sorted last night,

    [PHP]

    Private Sub cmdover_Click()

    If cmdover.Caption = "Show Clients with Overdraft" Then

    datCities.RecordSource = "SELECT Name, Name, Accnumber, Balance, Sortcode, Overdraft FROM Name WHERE Overdraft = 'YES' "

    datCities.Refresh

    MSFlexGrid1.Refresh

    cmdover.Caption = "Show Clients with Overdraft"

    End If

    End Sub

    [/PHP]


    LastIrishMonkey: Thanks for the offer you can send the code here: alpha1_2_32000@yahoo.co.uk

    Thanks joePC


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by bonkey
    Don't get me wrong....I hope you guys keep it up....it helps ensure that I'll never be out of a job.
    Roffle :D

    If I had a penny for every CS graduate I'd interviewed who'd gotten their degree by cogging other people's work... :rolleyes:


  • Registered Users, Registered Users 2 Posts: 32,461 ✭✭✭✭watty


    I'd create that SQL as a "view" and use an ordinary bound datagrid. No VB programming at all!


Advertisement