|
-
Jan 23rd, 2011, 02:47 PM
#1
Thread Starter
Junior Member
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.
-
Jan 23rd, 2011, 02:55 PM
#2
New Member
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
-
Jan 24th, 2011, 03:01 PM
#3
Thread Starter
Junior Member
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!
-
Jan 24th, 2011, 03:17 PM
#4
Frenzied Member
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
-
Jan 24th, 2011, 03:46 PM
#5
Thread Starter
Junior Member
Re: Sending data from text boxes/combo boxes to Access database?
 Originally Posted by billboy
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.
-
Jan 24th, 2011, 08:29 PM
#6
Frenzied Member
Re: Sending data from text boxes/combo boxes to Access database?
 Originally Posted by chrismid259
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
-
Jan 24th, 2011, 10:27 PM
#7
New Member
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.
-
Jan 24th, 2011, 10:50 PM
#8
Banned
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
-
Jan 30th, 2011, 08:43 AM
#9
Thread Starter
Junior Member
Re: Sending data from text boxes/combo boxes to Access database?
 Originally Posted by LadySylvia
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.
 Originally Posted by billboy
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.
-
Feb 8th, 2011, 12:13 PM
#10
Thread Starter
Junior Member
Re: Sending data from text boxes/combo boxes to Access database?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|