473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Reading Access Database Values with VB 6.0

1
Hello everyone.

I am a VB newbie and I'm trying to write code so I can get specific information from a table in a MS Access database. After reading the columns from the database, the information read should be stored on a n x 2 matrix (the matrix is n x 2 because I only need to know the information of two columns but have a random number of events on those columns).

Any help will be greatly appreciated.
Jun 11 '07 #1
2 9028
Hello everyone.

I am a VB newbie and I'm trying to write code so I can get specific information from a table in a MS Access database. After reading the columns from the database, the information read should be stored on a n x 2 matrix (the matrix is n x 2 because I only need to know the information of two columns but have a random number of events on those columns).

Any help will be greatly appreciated.
Your question seems very broad. If you can be more specific, I will try to help you.
Jun 13 '07 #2
nairda
39
Hello everyone.

I am a VB newbie and I'm trying to write code so I can get specific information from a table in a MS Access database. After reading the columns from the database, the information read should be stored on a n x 2 matrix (the matrix is n x 2 because I only need to know the information of two columns but have a random number of events on those columns).

Any help will be greatly appreciated.

Hello FmX,
I hope these code can give you a hint how to get specific value from MS Access table.
I don't understand about "n x 2 matrix", so I have these two textbox to show the value.
You need 1 Command button as a trigger of these actions.
Example: You have a database table (STUDENTFILE) that contains 5 Columns (STUDENTCODE, NAME, ADDRESS, GENDER, GRADE). You want to show only data from 2 columns (NAME, ADDRESS)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.     Dim conec As New ADODB.Connection
  3.     Dim rs As New ADODB.Recordset
  4.     conec.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source ='" & App.Path & "\mydatabase.mdb'"
  5.     conec.CursorLocation = adUseClient
  6.     conec.Open
  7.  
  8.     ' If you want to retrieve and show Student NAME and Student ADDRESS from STUDENTFILE table in textbox1 and textbox2, based on a spesific STUDENTCODE you typed in Textbox3
  9.     rs.Open "select NAME, ADDRESS from STUDENTFILE where STUDENTCODE = '" & Text3.Text & "'", conec, adOpenKeyset, adLockOptimistic
  10.     If rs.EOF = False Then
  11.         Text1.Text = rs!NAME
  12.         Text2.Text = rs!ADDRESS
  13.         Set MSHFlexGrid1.DataSource = rs
  14.         rs.MoveNext
  15.         rs.Close
  16.         cmdbaru.Visible = False
  17.     End If
  18. End Sub
NAIRDA
Jun 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: rob | last post by:
Hi to all. I am pretty new to using Access and am having a problem I hope someone can help me with. I want to access a MS-Access database from a web page. I have managed to get it "sort" of...
8
by: John Baker | last post by:
Hi: I am URGENTLY in need of some book or web site OR tool that will help me integrate a relatively simple access application into a web page or pages. This is a time recording system (by...
7
by: narshe | last post by:
I haven't come across an elegant way to do this yet, and would like to know what other people have come up with. There are two tables: CREATE TABLE EmployeeStatus ( pkId int not null primary...
0
by: Johanna | last post by:
Hello, Thread was being aborted exception is thrown by my asp.net application. I hope someone could help me with this error that I get in windows 2003 server. This error has not occured with...
7
by: Larry B via DotNetMonster.com | last post by:
Hello, I seem to be having a problem with inserting data, from a web form, into an access database. I have tried to do the same thing in a regular windows app, there it works fine, but when I...
4
by: Dan Lewis | last post by:
I've imported a ms access database into a table in a mysql database. The access database contains a field that holds date/time values in 'general date' format. These all show up at 01/01/1970 in...
1
by: vadarv | last post by:
Hia! I'm a total amateur to VBS but need help on a VBS script. This is used in a HMI system from Siemens called WinCC, used for process viewing and control. What I need to is to write to a table...
1
by: roger2282 | last post by:
help, I am trying to update a field on my database and cant seem to get the right value stored eg on reading the database field i get the values I need such as 31.24, 3.15 and 16.00 and I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.