Results 1 to 4 of 4

Thread: Access 2007

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    Access 2007

    Hello guys. I'm kinda new to this forum, but I have a question.

    I have an Access 2007 form. The form pulls the data from a query.

    Now, what kind of code could I use in VB to assign the current data (that is being displayed into forms) into variables.

    To explain what I am trying to do:

    The form pops up, and displays the current data of a customer. I want to be able to add a new customer, while checking that the customer does not exist.

    Thanks for any help.

  2. #2
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    452

    Re: Access 2007

    well, you can do this in a few different ways. the easiest is to let the database do if for you. if you're new to database design, i suggest reading up on database normalization. it will make things a lot easier. anyway, by making a field unique, you're telling the db to not insert a value if it already exists.
    first, what are you using to denote a customer? Username, email address, first name + last name? what ever you choose, you will need to either make it a primary (or compound primary) key or make it unique. By doing this, the database will not allow you to enter a value that already exists.

    Another way would be to do a select query first, then, if it returns null, run the update query. It's usually always easier, and best practice, to let the dbms (data base management system) enforce integrity. If you have more questions let me know

    jason
    if i was able to help, rate my post!

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    Re: Access 2007

    Hi Jason, sorry for the late respond.

    As far as letting the db do it itself, I apologize for not explaining well enough.

    The problem is I am wanting to pull the info from the user table, and merging it with a different table and adding to that second table. But my problem lies that when i try to do so right now, it tries to add the record to the user table. Im trying to figure out how to make it so it only adds it to the second table.

    Thanks again for the help

  4. #4
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    452

    Re: Access 2007

    can you post your code? You can use Select Into statement to select values from one table(s) and insert them into another. Let me see what your sql looks like and we can go from there
    if i was able to help, rate my post!

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