Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB & Database problem!!!!!!

Options
  • 10-03-2004 8: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 Posts: 2,145 ✭✭✭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: 630 ✭✭✭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 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 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 Posts: 32,417 ✭✭✭✭watty


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


Advertisement