[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Visual Basic Arrays and Access Database

Posted on 2003-11-11
6
Medium Priority
?
343 Views
Last Modified: 2013-11-25
I have a column in my access database table called "Lines", and I need it to be an array type somehow so that for each record in the table I can have multiple "Lines" and for each "Line" I can store an X1, Y1, X2, Y2.  Also, how would I use a select statement and update statement from visual basic to access and update that field?  I know I could just create a whole new table to do this for me, but would perfer not too.  I don't know a lot about access, use it rarely, so I'm sure is something beyond the basics I know to accomplish this.

Thanks, Jebus
0
Comment
Question by:dj__jebus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 

Author Comment

by:dj__jebus
ID: 9726774
I just found the menu thing insert a subdatasheet.  Is this along the lines if something I could use?  How does it work and how would I implement it in my vb project to make it work?  Or is it completely unrelated?

Thanks Jebus
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9726907
How about adding them to the field seperated by a carraiage return:

' add a refence to Microsoft ActiveX Data Objects Library:

Dim DataBase As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
DataBase = "C:\MyDataBase"

' open Database Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & DataBase & "'"
cn.CursorLocation = adUseClient
cn.Open

' open recordset
Set rs = New ADODB.Recordset
rs.Open "Select * From MyTable", cn, adOpenKeyset, adLockOptimistic

' add new record to Table
rs.AddNew
rs.Fields("Lines").Value = X1 & vbCr & X2 & vbCr & Y1 & vbCr & Y2
rs.Update

' update current record
rs.Fields("Lines").Value = X1 & vbCr & X2 & vbCr & Y1 & vbCr & Y2
rs.Update

' close recordset
rs.Close
Set rs = Nothing

' close connection
cn.Close
Set cn = Nothing


0
 

Author Comment

by:dj__jebus
ID: 9727271
I would like to try using this subdatasheet thing.  I have a table called "Jobs" in which I have a subdatasheet called "Walls"  In Walls I have my WallID, X1, Y1, X2, Y2 columns.  So all I need now is to write my sql string to be able to select and update things from the Walls table for each record in Jobs.

Thanks Jebus
0
 

Accepted Solution

by:
dj__jebus earned 0 total points
ID: 9744514
Well, I figured it out on my own.  I just made another table for Walls and used the relations thing in access.  I then used a normal select statement with a where JobID=blah  thing.

Thanks, Jebus
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question