Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2014
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert Into with select statement in Access 2010

    I have a form "frm_CL_Sch_SelectComp" that has a subform called "frm_CL_Sch_SF_SelectComp". The main form has a control called txtClassID that is bound to the ClassID field.

    On the subform there are 15 check boxes that I have an SQL Insert Into statements that obviously insert records into a table. The code is:

    If Me.ckEvaluation = True Then
    DoCmd.RunSQL "INSERT INTO tbl_CL_Sch_ClassSchComp ([Event], [Length], [CountsAsCE], [AlternateTitle])" & _
    "VALUES ('Evaluation', 5, True, 'Evaluation'); "
    End If

    My problem is that I need to get the ClassID into the table for each record. I think I need a Select From statement. But, I have been unable to figure out how to make that happen with the Insert Into statement. I would really appreciate any help to directing me in the right direction.

    Thank you.

    Fay

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,435
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Fay,

    I believe this will work.

    Forms!frm_CL_Sch_SelectComp!txtClassID

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    New Lounger
    Join Date
    Sep 2014
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Mr. RetiredGeek. I solved the problem. I am sorry I didn't get back to say so.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •