Results 1 to 5 of 5

Thread: A kinda easy database question

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Exclamation

    I have a question. I have 5 tables in a database how do i access them without using 5 differant data controls like i have check boxes and if that is checked then i want it to open that table so i can write to that table? if anyone can help me that would be great

  2. #2
    Guest
    You mean change the RecourdSource?
    Code:
    Data1.RecordSource = "Employees"
    Data1.Refresh

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    Code:
    Dim sTableName As String
    
    Select Case CheckBoxArray
        Case CheckBoxArray(0)
            sTableName = "First_Table"
        Case CheckBoxArray(1)
            sTableName = "Second_Table"
        Case CheckBoxArray(2)
            sTableName = "Third_Table"
        'and so on
    End Select
    
    'Then use the table name in you SQL statement
    'to insert records into that table

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59
    yes that is exactly what i want now whats the code i saw some but im not sure exactly with sql

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You mean like this:
    Code:
    rst.RecordSource = "TableName"
    
    rst.AddNew
    rst.Fields("Field1").Value = "xxx"
    rst.Fields("OtherField").Value = 5
    rst.Update
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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