Announcement

Collapse
No announcement yet.

Looking for Visual Basic help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Looking for Visual Basic help

    And I just pray someone here actually knows it.

    Ok, I've got a project called prjTodsTyres. I've got a frmMain which then leads to frmJobs. This can be seen in This Picture. From here you can view Tod's many tyre jobs. This part works. So next you click on Create Invoice, which opens frmInvoice.

    Now, this is where it gets crappy. I've included all of the frmInvoice code at the bottom of the page so anyone with experience might go through it and point my errors out, much appreciated.

    When frmInvoice loads, it gathers the incorrect information. As you'll see in that picture I linked to, i've picked to make an invoice for Blue Fox, yet Ritual's details come up. This is the code I used to theoretically produce Blue Fox details:

    datInv.RecordSource = "SELECT FROM Customers WHERE CompanyName = frmJobs.txtCustomer "

    I've double-triple-quadruple-checked those names. datInv points to the correct database, and does indeed select data from Customers>CompanyName. Only problem is it always picks the first file's data, Ritual. This happens for every customer.

    I also have a problem with the discount code, but i'll ask about that after I get help fixing this problem.

    P.S. Haste is appreciated, since the deadline is today. Thanks so much for any consideration you put towards this.

    Originally posted by My Code
    Dim TyreCost As Integer

    Private Sub Command1_Click()
    frmInvoice.Hide
    End Sub

    Private Sub Command2_Click()
    frmInvoiceCustom.Show
    End Sub

    Private Sub Form_Activate()

    ' Label Stuff
    lblInvoiceNo.Caption = "Invoice #:" & frmJobs.txtJobID.Text
    'TXT Stuff

    'txtCompany.Text = frmJobs.txtCustomer.Text
    'txtTyreNo.Caption = frmJobs.txtTyreNo.Text
    'txtTyresSold.Caption = frmJobs.cboTyreType.Text

    ' complicated Tyre Type IF Statement

    If frmJobs.cboTyreType.Text = "155/80S13" Then
    TyreCost = 36
    Else
    If frmJobs.cboTyreType.Text = "165/80S13" Then
    TyreCost = 39
    Else
    If frmJobs.cboTyreType.Text = "155/80S14" Then
    TyreCost = 58
    Else
    If frmJobs.cboTyreType.Text = "165/80S14" Then
    TyreCost = 64
    End If
    End If
    End If
    End If

    txtCostEach.Caption = "£" & TyreCost

    ' More complicated TXT Stuff
    lblTotalCost.Caption = "£" & TyreCost * txtTyreNo.Caption

    If frmInvoiceCustom.Check1.Value = True Then
    lblDiscounted.Caption = lblTotalCost.Caption * 0.95
    Else
    lblDiscounted.Caption = "N/A"
    End If

    ' Data Stuff


    datInv.RecordSource = "SELECT FROM Customers WHERE CompanyName = frmJobs.txtCustomer "
    datInvJobs.RecordSource = "SELECT FROM Jobs WHERE JobID = frmJobs.txtJobID "

    End Sub
    Private Sub Form_Load()
    txtDate.Text = Date
    'datInv.RecordSource = "SELECT * FROM Customers WHERE CompanyName = " & "'" & frmJobs.cboCustomer & "'" & ""
    'datInv.Refresh
    'datInvJobs.RecordSource = "SELECT * FROM Jobs WHERE JobID = " & "'" & frmJobs.txtJobID & "'" & ""
    frmStock.Show
    frmStock.Hide
    'frmInvoiceCustom.Show
    'frmInvoiceCustom.Hide
    End Sub

    #2
    datInv.RecordSource = "SELECT FROM Customers WHERE CompanyName = frmJobs.txtCustomer "
    datInvJobs.RecordSource = "SELECT FROM Jobs WHERE JobID = frmJobs.txtJobID "

    End Sub
    Private Sub Form_Load()
    txtDate.Text = Date
    'datInv.RecordSource = "SELECT * FROM Customers WHERE CompanyName = " & "'" & frmJobs.cboCustomer & "'" & ""
    'datInv.Refresh
    'datInvJobs.RecordSource = "SELECT * FROM Jobs WHERE JobID = " & "'" & frmJobs.txtJobID & "'" & ""
    frmStock.Show
    frmStock.Hide
    'frmInvoiceCustom.Show
    'frmInvoiceCustom.Hide
    End Sub
    Perhaps it's the fact that you're using "SELECT FROM Customers" and "Select FROM Jobs" instead of "Select * FROM Customers" and "Select * FROM Jobs"

    If you know anything about SQL you should be able to see the difference. Let me know if that doesn't work and I'll do a more in-depth code review.

    --Tom
    Thomas G Sluder
    Smyrna, DE, USA

    Comment


      #3
      I'm studying visual basic advanced at the moment, and it's kicking my buttocks because i'm a loser, and I have ADHD, did I mention I'm a loser, and very slow, and semi-retarded, and is constantly battling the crazies, and on top of that, I'm a dreamer who has started a thousand stories but has only finished three--- I'm a Loser. But i'm trying to be better, and I wanna, use Visual Basic to write cool programs that can actually build whatever I want. For example; I'll write a program and give it a library of code, but here's my problem, i need a bunch of code that does things, like look for things, or be able to open messages look for key words and then send out those request to build stuff, so even if i'm able to force my ignorant self to build an awesomely difficult program, i'd never ever have to rack my brain to do anything like that again since my program will simply do everything else i need done


      By the way, I wanna place this here just in case, an idea i had for fringe i posted at IO9 last year, and one cannot be to safe.

      (Author's note, ya'll may hate me for this and that's fine, every body hates me, maybe it's because i encourage said hate, but---let the hate flow) Fringe Ignus Faatus Global Financial sign on the outside of the building, daytime. man enters building, he's blowing his nose, he looks pale as he enters the elevator, people are noticeably perturbed but says nothing. He enters his office and Rose the receptionist near the elevator is also blowing her nose. every one in his office looks sick, just above the office in the vents there is a small singularity, a black substance is escaping, we're hearing a slight noise as if the black smoke like substance is playing a distinct tune, barely audible. Fred (the guy from the elevator) picks up a ringing phone and tells Rose that her husband and baby daughter is down stairs. Rose heads for the elevator and sneezes repeatedly as she goes down. They're tax auditors on this floor and several visitors sitting in the waiting room wants to leave because every one, more than two dozen auditors are sick or look sick. Fred is looking at his screen talking to a client complaining about her taxes (an elderly lady) when he notices a strange java animation starting on his computer, he tells the woman to excuse me and presses escape, but alas the gif remains and the CANDY MAN by Sammy Davis jr song is heard. Fred turns about and grabs his ear, no head phones. The world pools into vibrant color, much like a Disney animation and a human looking man wearing a large Dr Seuss top hat with colorful eyes dances in tune with the beat, twirling a candy cane. Fred notices his co workers in the surreal world is like him; astonished and amazed. The Candy Man points to trees made of chocolate and candy, Fred feels sick but once the Candy Man offers him a piece of chocolate he feels infinitely better, color returns to his face, and his eyes glow, he attacks the various trees, devouring their sweetness. Some are consuming trees and dancing. Rose is down stairs leaping at various trees until she notices one in the distance, a smaller more delicious one, she attacks it ripping out all the sweet cherry filling. Laughing and giggling, feeling infinitely better, one of the trees falls on her and she throws it back with superhuman strength, laughing as she does. She falls on the tree eating it, juices pouring from her mouth, her animated world begins to fade as the Candy Man song fades away. Fred eating a rather large chocolate tree branch suddenly stops and drops a human arm, other co workers are still eating, but it isn't candy. Rose comes to and sees her husband with his chest and throat torn open looking at her terrified dying, she says Charles her mouth bloody, then she thinks, 'Charles wears our baby?" in her hand is diaper, and she spins about and we only see a baby an over turned carriage and we hear Rose screaming. J. D Barr Nassau Bahamas(let's be friends eh, pretty please)

      Comment


        #4
        Originally posted by SoulRe@ver
        interesting - how did you code this in Visual Basic ?
        That's it, I haven't done it yet, I'm tryinig to understand basic Advanced Visual Basic 2005 by Kip Irvine and Tony Gaddis and I'm not reading any magic bullets; there is nothing that says, (hypotheticals):- If you want a program that calls for ABC type this

        If blah blah blah


        And if you want a program that can search for pictures or programs do

        If Blah Blah Blah


        Use those templates to do this or that, but if you wanna do something more difficult add a few

        If reader.HasRows () Then Blah blah blah


        There is nothing like that anywhere, and I tried C++ but I'm infinitely too stupid to figure that out. Maybe if I went to a school in the states somewhere, or in Canada, where they could take a slow person such as myself on a step by step and can show me how so many symbols achieve real world programs, then I'd probably be able to understand all this mumbo jumbo, because here in the Bahamas, No one, can show you anything.


        But all i wanna build is a program that can go to a library of files and use them to build any means, by which to complete whatever i want, and by whatever i mean simple stuff; how to build a spread this, or a basic cash return or statement whats it for clients, then get paid for it ---I know the program will probably be the most difficult thing in the world to complete, but, once completed, I can make a ton of cash and not have to worry about my pathetic brain farts which gets in the way of everything. I may have a tumour because I'm that stupid and slow sometimes.
        Last edited by Coremae; 01 September 2010, 01:07 PM.

        Comment

        Working...
        X