-
Question about Access database Connected with VB
Hi ,
am kind of in conflict here
I created a database using access
table name is appraisal table
three columns
Research Paper , Conference , Others
Research Paper = 10 Points
Conference = 5 Points
Others = 3 Points
Anyway what I want to do is the three columns type is checkbox
create data grid view in visual basic and load appraisal table
when user run the program and checkbox all of them it should show 18 points in a label , or textbox , or anywhere ;P
how can I do that ?
-
Re: Question about Access database Connected with VB
Your description leaves a lot to imagination. Are those points different for each record? when user runs the program which record will be displayed?
-
Re: Question about Access database Connected with VB
yeah sorry due to my bad English lead to poor explantation
each of those records have a value I don't know if that is possible in access to be done , I know you can create records and insert values in access but I don't know if I can give those records value and make them checkbox style in the table
User : run the program , see three checkboxes , if he tick all of them , 18 Total Points should be displayed on a label , textbox , or any item can be used as display
is that clear ?
-
Re: Question about Access database Connected with VB
Almost. WHen you say 18, is that always? Does it depend on the record selected by the user? It could help if you describe what the points mean. What is the purpose of your application? Is it a school project?
-
3 Attachment(s)
Re: Question about Access database Connected with VB
first, you need your database set up correctly:
Attachment 112845
Attachment 112847
then you can use this code:
Code:
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Paul\Documents\appraisal.accdb;Persist Security Info=False;")
Dim da As New OleDbDataAdapter("SELECT * FROM [appraisal]", con)
Dim dt As New DataTable
da.Fill(dt)
dt.Columns.Add("value")
dt.Columns("value").Expression = "IIf(Research_Paper,10,0)+IIf(Conference,5,0)+IIf(Others,3,0)"
DataGridView1.DataSource = dt
DataGridView1.Columns(3).Visible = False
Label1.DataBindings.Add("Text", dt, "value")
End Sub
End Class
which will set up your dgv + label databindings how you wanted them:
Attachment 112849
-
Re: Question about Access database Connected with VB
yes it is school project lool ;p
yeah it is should always be 18 , yes it depend on the user if he select one record or all or record , points is just a weight for each record
for example I have a database of fruits table that contain ( apple , mango , orange) and
their prices is
apple = 5$ ,
mango 10$ ,
orange $$
after creating a form in visual basic , loading fruits table into data grid view I will be able to view the records right apple, mango, orange
their type is checkbox , after I check all of them it should give me the total price , I should put it somewhere in label or textbox or if it is possible I can save it into another database but that Is difficult I just want to learn the first part only ;S
-
Re: Question about Access database Connected with VB
I HAVE A PROBLEM!! In Visual Basic, I need to split a csv file into an array and then find max and min values for parts of that array. I am quite stuck at the moment and really need assistance.
Thanks.
-
Re: Question about Access database Connected with VB
Quote:
Originally Posted by
DylanM
I HAVE A PROBLEM!! In Visual Basic, I need to split a csv file into an array and then find max and min values for parts of that array. I am quite stuck at the moment and really need assistance.
Thanks.
Dylan, first: welcome to the forums. But please start a new thread if you have a question instead of hijacking someone else's. Specially if your issue is so different from the OP's.
-
Re: Question about Access database Connected with VB
Hi Mr Paul ,
I checked and done the steps but I think there is something wrong I did , check my screenshots
my table in access
http://i60.tinypic.com/v5iplv.jpg
the code I put and put my database table source
http://i60.tinypic.com/raan0o.jpg
is my source is wrong , ?
because I have two database with same name one inside folder after the VB copy it when I use data source connection
-
Re: Question about Access database Connected with VB
jack, your questions are confusing me more that before.
How can you say it is always 18 if then you say apple=5, mango=10? where does that fit in?
how can the fields be checkbox type if they have numbers as values?
Do you have a table with columns named apple, mango and orange or are these values in different records?
-
Re: Question about Access database Connected with VB
To correct those errors put this line before the class declaration:
Code:
Imports System.Data.OleDb
The rest of the code is confusing, what are you trying to do?
-
Re: Question about Access database Connected with VB
Mr Kaliman , apple and mongo what just an example of the previous one ;o
appraisal table ( Research Paper = 10 Points , Conference = 5 Points , Others = 3 Points )
I don't know how can numbers or values assign to the records or columns but Mr Paul did it and am trying to do it as well ,
forget about fruits table , lets go again for appraisal
Column 1: Research Paper , Column 2: Conference , Column 3:Others
Their Values Should Be: 10 , 5 , 3
It is a table with 3 columns , and yes those values should be assigned to their columns !
I don't know actually how does it fit but am trying mr paul work as that what I want to do
but currently having something wrong and am trying to get it maybe my source wrong or something else
-
Re: Question about Access database Connected with VB
yes I put this line now , again something else showed up !
http://i62.tinypic.com/2bd5rq.png
-
Re: Question about Access database Connected with VB
http://i57.tinypic.com/s3n0ir.png
Something wrong Mr.Paul and Kaliman , what do you think ? shall I try it from the beginning ?
-
Re: Question about Access database Connected with VB
You need to close Access when you run your project
-
Re: Question about Access database Connected with VB
Do you have the Access Database open?
-
Re: Question about Access database Connected with VB
Well I try it again , new folder System , new database appraisal, new visual basic application Faculty System
http://i58.tinypic.com/2mx04qv.png
There is still a message , when I run the application ms access is closed :)
-
Re: Question about Access database Connected with VB
after removing this line of code
DataGridView1.Columns(3).Visible = False
the program work but not functional or accurate , I had to click up , down then start to count and even not correct !
http://i57.tinypic.com/sfdmhi.png
-
Re: Question about Access database Connected with VB
Thanks to Mr Paul & Kaliman for the help , what I wanted to do didn't work
I will try to plan more and see another way , I might post another topic tomorrow about same issue but in different way :)
Hope there will be someone to help same as today
Regards,
Jack
-
1 Attachment(s)
Re: Question about Access database Connected with VB
here's a working example: Attachment 112857
-
Re: Question about Access database Connected with VB
I try to download the attachment it give me
attachment.php (23.6 KB)
after downloading it and change format to zip and open it , the file is corrupted
-
Re: Question about Access database Connected with VB
It is working opening properly for me (in Firefox and IE), is it working for you now? (it may have been a temporary glitch)
-
Re: Question about Access database Connected with VB
-
Re: Question about Access database Connected with VB
Works fine from Chrome for me as well.