Results 1 to 4 of 4

Thread: Organizing data so its easy to get.

  1. #1

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    Organizing data so its easy to get.

    My problem is retrieving data from a database.

    I really don't know all the available otions to me.

    So i created a Access database to just function as a storage device.

    I know the are better ways to organize data so it is easily accessed..

    Does anyone Know where I should start..

    Here is samlpe code of me accessing access..

    VB Code:
    1. Public Sub GetElectricsCosts()
    2. Dim rstElect As Recordset ' record set variable
    3. Dim i As Integer
    4. Set DbsVacublast = OpenDatabase(PATH) 'setting database object var
    5. Set rstElect = DbsVacublast.OpenRecordset("ElectPanel")
    6.     rstElect.Index = "PrimaryKey"
    7.    
    8.     rstElect.Seek "=", m_floorConfiguration
    9.    
    10.         For i = 0 To 2
    11.                   m_ElectCost(i) = rstElect(i + 1)
    12.         Next i
    13.        
    14.     rstElect.Close
    15.     DbsVacublast.Close
    16. End Sub

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Code:
    Public Sub GetElectricsCosts()
        Dim rstElect As Recordset 
        Dim i As Integer
    
        Set DbsVacublast = OpenDatabase("C:\Path\aDatabaseFile.mdb") 
        Set rstElect = DbsVacublast.OpenRecordset("SELECT * FROM TableName WHERE ColumnName = '" & searchstring & "'")
    End Sub
    If you are just trying to look up a value, take a look at SQL or SELECT querties in the access / vb help files. The above gives the general idea, but if you don't get it, please ask.

    Note though - I've put single quotes in there. To show this, I'll put spaces in the below, but to get the string to work okay, you'll need to take these out again :
    Code:
    ColumnName = ' " & searchstring & " ' " )
    Cheers

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    From VB
    How would I create a createtable query, and then from that table pull the information I want all at once..



    See, prblem is that I am connecting 10 time all at the same time..to get required data..

    Follow????

    I know what I want to do.. just I have no idea where I should start learning.

    SeaHag

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    seahag, have you got maybe a small databse you could send with instructions on what you need, not 100% sure what you're after, have a faint idea, but if it's possible it'd be better if you could send an example.

    Cheers.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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