Results 1 to 6 of 6

Thread: [Resolved]Adding to Databases

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    8

    Post [Resolved]Adding to Databases

    Hi Everybody,

    I am currently a college student who has only been developing with VB for a short time and just trying to get my head around certain things. I've added items to a database using VB "Within" Microsoft Access, although i have yet to implement this feature using Visual Basic 6.

    What i am planning to do is to make a kind of account creation system within my application. I am using a Data Control to define my database and i want to add data to four fields in my database.

    So quickly done below is the form that will be used to collect the data required and then on the click of a button it will add itself to the database i specify. (Re-enter Password is mainly put for validation purposes)


    I have been testing out coding such as using the Addnew function etc, but i just can't seem to get my head around it. Any help would be seriously beneficial to me

    Many Kind thanks in advance
    Leigh
    Last edited by Leigh; Feb 17th, 2006 at 11:29 AM. Reason: Resolved

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Adding to Databases

    Welcome to the forums.

    Post the .AddNew code that you have that isn't working.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    8

    Re: Adding to Databases

    Thanks for the welcome! Looks like i'll be around here often the way i'm going on! lol

    datDatabase.Recordset.AddNew
    datDatabase.Recordset!First_Name = txt_Regfirstname
    datDatabase.Recordset!Surname = txt_Regsurname
    datDatabase.Recordset!Username = txt_RegID
    datDatabase.Recordset!Password = txt_RegPass

    The above may be entirely incorrect because our tutor didn't really go into any detail on how to add through VB6, i've just tried to understand what's been on websites.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Adding to Databases

    VB Code:
    1. datDatabase.Recordset.AddNew
    2. datDatabase.Recordset!First_Name = txt_Regfirstname
    3. datDatabase.Recordset!Surname = txt_Regsurname
    4. datDatabase.Recordset!Username = txt_RegID
    5. datDatabase.Recordset!Password = txt_RegPass
    6. datDatabase.Recordset.Update '[b]add this line[/b]

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    8

    Re: Adding to Databases

    ah, works like a charm now! Thanks a lot!

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Adding to Databases

    Quote Originally Posted by Leigh
    ah, works like a charm now! Thanks a lot!
    No problem and good luck on your project.

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