Results 1 to 10 of 10

Thread: Sending data from text boxes/combo boxes to Access database?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    Question Sending data from text boxes/combo boxes to Access database?

    Hi,

    I'm in the middle of creating an application that will be used to input customer information whilst the customer is speaking to someone over the phone. This involves the customer giving the employee information such as name, address, postcode etc and the employee inputting that information into text boxes and combo boxes that are in the application.

    What I would like to be able to do is after the customers information is given over the phone, I need to be able to send that information to a database which will probably most likely be done by button click. In this case, I'm using Microsoft Access. I'm also hoping that I can do this within Visual Basic coding.

    The database is set out with multiple tables which include a customer table and a ticket table and both have multiple fields such as first name, surname in the customers table. Both of these tables are in use with the information that the customer gives over the phone.

    I've already asked on other forums and people are where replying giving me third party programs that I could use to implement this, something I don't really want to do.

    Hopefully that all makes sense.

    Hope someone can help with this.

    Thank you in advance.

    Chris.

  2. #2
    New Member
    Join Date
    Jan 2011
    Posts
    5

    Re: Sending data from text boxes/combo boxes to Access database?

    I actually just finished studying this. Here's how you need to code:

    Code:
    Dim info as datarow
    info = Me.YourDataSet.TableName.NewRow()
    
    info.Item("ColumnName") = me.txtFirstName.Text
    info.Item("ColumnName") = me.txtLastName.Text
    !-- Do the same for all text boxes
    
    me.YourDateSet.TableName.Rows.Add(info)
    Me.TableNameTableAdapter.Update(Me.YourDataSet)
    You'll first need to know how to connect a database to your application.

    LadySylvia
    Last edited by LadySylvia; Jan 23rd, 2011 at 02:56 PM. Reason: typing error

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    Re: Sending data from text boxes/combo boxes to Access database?

    Hi,
    Thank you for your reply!

    I'm slightly confused about some aspects of the code that you've provided.

    info = Me.YourDataSet.TableName.NewRow()
    In this line of code, am I supposed to add the name of my data set where "YourDataSet" is shown? I've already tried this and it always returns an error.

    info.Item("ColumnName") = me.txtFirstName.Text
    I don't understand what I'm supposed to input into the "me.txtFirstName"? Do I input a column name or something database related?

    Also, in "ColumnName", do I simply just input the name of the column in the database?

    Sorry if this is slightly annoying.
    Thank you again!

  4. #4
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: Sending data from text boxes/combo boxes to Access database?

    info = Me.YourDataSet.TableName.NewRow()

    you put the name of your dataset and the name of the table

    info.Item("ColumnName") = me.txtFirstName.Text

    put the name of the column in quotes = is the textbox where your firstname is

    hope that helps

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    Question Re: Sending data from text boxes/combo boxes to Access database?

    Quote Originally Posted by billboy View Post
    info = Me.YourDataSet.TableName.NewRow()

    you put the name of your dataset and the name of the table

    info.Item("ColumnName") = me.txtFirstName.Text

    put the name of the column in quotes = is the textbox where your firstname is

    hope that helps
    After I input the code I get multiple errors relating to the data sets code.

    I'm referring to the customers data set in this example as I'll be updating customer records when the 'Send to database' button is clicked. The code I've input is below.

    Dim info As DataRow

    info = Me.CustomersDataSet.customers.NewRow()

    info.Item("forename") = Me.txtForename.Text
    info.Item("surname") = Me.txtSurname.Text

    Me.CustomersDataSet.customers.Rows.Add(info)
    Me.CustomersTableAdapter.Update(Me.CustomersDataSet)

    Errors are shown in italics here.

  6. #6
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: Sending data from text boxes/combo boxes to Access database?

    Quote Originally Posted by chrismid259 View Post
    After I input the code I get multiple errors relating to the data sets code.

    I'm referring to the customers data set in this example as I'll be updating customer records when the 'Send to database' button is clicked. The code I've input is below.

    Dim info As DataRow

    info = Me.CustomersDataSet.customers.NewRow()

    info.Item("forename") = Me.txtForename.Text
    info.Item("surname") = Me.txtSurname.Text

    Me.CustomersDataSet.customers.Rows.Add(info)
    Me.CustomersTableAdapter.Update(Me.CustomersDataSet)

    Errors are shown in italics here.
    Need to see all the code for this I was answering the specific question about what went where yourdataset and textbox

  7. #7
    New Member
    Join Date
    Jan 2011
    Posts
    5

    Re: Sending data from text boxes/combo boxes to Access database?

    I'm wondering two things: did you connect the data source to the application?
    and what type of system do you have?

    you might be getting the same errors I had when I started in vb.

  8. #8
    Banned
    Join Date
    Mar 2009
    Posts
    764

    Re: Sending data from text boxes/combo boxes to Access database?

    download my book it has walkthroughs about using ms access databases in vb.net

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    Re: Sending data from text boxes/combo boxes to Access database?

    Quote Originally Posted by LadySylvia View Post
    I'm wondering two things: did you connect the data source to the application?
    and what type of system do you have?

    you might be getting the same errors I had when I started in vb.
    Yes, I believe I have connected the data source to my application. Not sure what you mean by what system I have.

    Quote Originally Posted by billboy View Post
    Need to see all the code for this I was answering the specific question about what went where yourdataset and textbox
    The code I posted here previously is all the code I have for this form at the moment.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    Re: Sending data from text boxes/combo boxes to Access database?

    Bump!

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