Results 1 to 4 of 4

Thread: Select query in visual basic 6

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2014
    Posts
    8

    Select query in visual basic 6

    Hi guys,

    I'm a newbie to this forum and to vb6.I just want to ask some help for my query.

    I have a table prodmaster with fields pieceCode,dozenCode,caseCode, proddesc ,inventoryUnit.
    example: pieceCode | dozenCode | caseCode | proddesc | inventoryUnit
    110 111 112 Apple 72

    note: inventory unit is constant and all code refers to one item only
    I also have a flexgrid and a txtinvno.text

    If I put invoice number in the textbox say inv#00152
    My flexgrid displays all the products issued in that invoice (inv#00152) and those products may be served in dozen,in piece or in case.


    what I want to do now is if my flexgrid(2,1)=rs!pieceCode or flexgrid(2,1)=rs!dozenCode or flexgrid(2,1)=rs!caseCode then flexgrid(2,2)=flexgrid(2,2)/rs!inventoryUnit.

    the value of flexgrid(2,1) piececode,dozencode,or casecode of the product issued since we serve some items in piece,dozen, or case.
    the value of flexgrid(2,2) is the quantity issued.

    .
    can anybody out there help me? what should be my query for this.


    I tried Select * from prodmaster where prodCode='"& flexgrid(2,1) &"' or dozenCode='"& flexgrid(2,1) &"' or caseCode='"& flexgrid(2,1) &"' ,

    I know it can't be done this way,

    help please.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Select query in visual basic 6

    Welcome to VBForums

    Thread moved from the 'CodeBank VB6' forum (which is for you to post working code examples, not questions) to the 'VB6 and earlier' forum

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Select query in visual basic 6

    I'm not sure what you are doing there. Your or statements do not make sense.

    Perhaps what you need to do is query the DB based on product code and the use a select case to determine which unit is active for that item?
    I am just guessing as I have no idea what values may be there.

  4. #4
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Select query in visual basic 6

    Right. I was thinking the same thing, but didn't want to answer as DB's are not my forte.

    Generally you create a lookup table for units containing containing fields for UnitID and Its UnitName.

    You populate a listbox or combobox with this content.
    When the user makes a selection from the listbox you populate the selected flexgrid's datasource record with the selected unit.

    There should only be one field for units in the target table.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

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