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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB & Database problem!!!!!!

  • 10-03-2004 7: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,152 ✭✭✭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, 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,417 ✭✭✭✭watty


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


Advertisement