Results 1 to 3 of 3

Manipulate DB through VB ...

  1. #1
    Zoroxeus is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2005
    Posts
    12

    Manipulate DB through VB ...

    Here is the $1M question


    I have this form displaying the fields of a database (with the next, previous button) ... classic one;..
    i have a field that i put with two choic: "Yes" and "No"
    (dropdown type of menu)
    I want that when i chose Yes or No, somewhere in a the database, a table, the value of a field (initially empty) becomes empty...
    so i tried to do something of the type:
    So I know how to start (If value = Yes ) ...
    but I don't know how the insert statement would work through vb ??

    Another question is I have a text box in a form, I want this box to display the sum of all the data from a field in my table ?

    I am having a hard time making the bridge between the event procedure code and my table ...
    any help would be appreciated !

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275

    Re: Manipulate DB through VB ...

    Quote Originally Posted by Zoroxeus
    I want that when i chose Yes or No, somewhere in a the database, a table, the value of a field (initially empty) becomes empty...
    so i tried to do something of the type:
    So I know how to start (If value = Yes ) ...
    but I don't know how the insert statement would work through vb ??
    You could use an OnChange event sub for that control, and to execute a SQL command you would have lines like:

    Code:
    With DoCmd
        .SetWarnings False
        .RunSQL "Your SQL statement goes here"
        .SetWarnings True
    End With
    Quote Originally Posted by Zoroxeus
    Another question is I have a text box in a form, I want this box to display the sum of all the data from a field in my table ?
    Use DSum().

    =DSum("[Yourfield]", "[YourTable]", "Criteria if needed")

    Or, use a SQL Statement:

    =(SELECT Sum(Yourfield) FROM YourTable)

  3. #3
    Zoroxeus is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2005
    Posts
    12
    Thanks, I am going to try
    Will let you know

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums