Inserting collected data into a access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mousewonders
    New Member
    • Sep 2007
    • 3

    #1

    Inserting collected data into a access database

    Hi Guys,

    I am very new to VB. I am working on a project for class that will let people sign in to a fitness center and sign out.

    I have no clue what I am doing. I have searched and read and read and I can't seem to figure out how to insert data that I collect on a form I created into an Access database.

    I know I can do it if I drag and drop the tables onto the form but I need for the form to make sure the user exists before submitting the data. Here is the project

    Access Database 3 Tables
    WhoIsHere
    Users
    History


    The WhoIsHere table has three fields:
    UserID
    TimeIn
    DateIn

    Users table:
    UserID
    Firstname
    Lastname
    EmpRelation

    History table
    UserID
    TimeIn
    DateIn
    TimeOut
    DateOut

    Now, I have created 4 forms

    A welcome form which shows a Sign In and a Sign Out and a Register Button

    Sign In
    One textbox (for the user to scan the ID) this is where I am stuck... I need upon scan to make sure the user exists by looking up the ID in the Users Table and if they do exist I need them inserted into the WhoIsHere Table with the date and time.

    My goal is to move the record from the WhoIsHere upon signout to the History table and insert a time out.

    Can someone please help me out? If I can see how this is done I should be able to figure out how to do the rest.

    I would be willing to pay for some help if need be. Just let me know. I work best from examples.

    Richard
    Last edited by mousewonders; Sep 8 '07, 03:48 PM. Reason: forgot a word
  • mousewonders
    New Member
    • Sep 2007
    • 3

    #2
    Why doesn't this work? I have this assigned to a button:

    [CODE=vb]Dim con As New OleDb.OleDbConn ection
    con.ConnectionS tring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\Docum ents and Settings\leight r\My Documents\Visua l Studio 2005\Projects\c ma\cma\culverfl ex.mdb"
    Dim da As OleDb.OleDbData Adapter
    Dim signInNow As String
    con.Open()
    signInNow = "INSERT INTO `whoishere` (`userid`, `timein`, `signdate`) VALUES (10, 12:00:30 PM, 12/22/81)"
    da = New OleDb.OleDbData Adapter(signInN ow, con)
    con.Close()[/CODE]

    Comment

    • mousewonders
      New Member
      • Sep 2007
      • 3

      #3
      Well, I have figured out how to insert the data from a form into Access.

      Now I need help with:


      How do I look up a record based on input of a textbox (userid) and move it to another table?

      Comment

      Working...