On Oct 5, 2:54*am, John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com>
wrote:
> On Tue, 4 Oct 2011 17:00:22 -0700 (PDT), Fev <hgos...@worldonline.co.za>
> wrote:
>
> >SQL1 = "INSERT INTO tblLSMDetail ( ProjectLSM, ProjectArea, ProjectID,
> >ProjectEthnic, ProjectGender, ProjectAgeGroup )" & _
> >"SELECT tblProjectLSM.ProjectLSMID, tblProjectArea.ProjectAreaID,
> >tblProjectLSM.ProjectID, tblProjectEthnic.ProjectEthnicID,
> >tblProjectGender.ProjectGenderID,
> >tblProjectAgeGroup.ProjectAgeGroupID" & _
> >"FROM tblProjectArea, tblProjectLSM, tblProjectEthnic,
> >tblProjectGender, tblProjectAgeGroup" & _
> >"WHERE (((tblProjectLSM.ProjectID)=[Forms]![frmSampleBuilder]!
> >[ProjectID]))"
> >I
>
> You're missing some critically important blanks. The lines that you're
> concatenating don't have trailing blaks so you're ending up with meaningless
> items like ProjectAgeGroupIDFROM and tblProjectAgetGroupWHERE. Try including
> blanks in the string pieces you're putting together:
>
> SQL1 = "INSERT INTO tblLSMDetail ( ProjectLSM, ProjectArea, ProjectID, " & _
> "ProjectEthnic, ProjectGender, ProjectAgeGroup ) " & _
> "SELECT tblProjectLSM.ProjectLSMID, tblProjectArea.ProjectAreaID, " & _
> "tblProjectLSM.ProjectID, tblProjectEthnic.ProjectEthnicID, " & _
> "tblProjectGender.ProjectGenderID, " & _
> "tblProjectAgeGroup.ProjectAgeGroupID " & _
> "FROM tblProjectArea, tblProjectLSM, tblProjectEthnic, " & _
> "tblProjectGender, tblProjectAgeGroup " & _
> "WHERE (((tblProjectLSM.ProjectID)=[Forms]![frmSampleBuilder]![ProjectID]))"
> --
>
> * * * * * * *John W. Vinson [MVP]
> *Microsoft's replacements for these newsgroups:
> *http://social.msdn.microsoft.com/For...-US/accessdev/
> *http://social.answers.microsoft.com/.../en-US/addbuz/
> *and see alsohttp://www.utteraccess.com
Hi John
Thanks for the pointers, I have added extra spaces in at the end of
each line, but still get the Type mismatch error. My code now reads:
SQL1 = " INSERT INTO tblLSMDetail ( ProjectLSM , ProjectArea ,
ProjectID , ProjectEthnic , ProjectGender , ProjectAgeGroup ) " &
_
" SELECT tblProjectLSM.ProjectLSMID ,
tblProjectArea.ProjectAreaID , tblProjectLSM.ProjectID ,
tblProjectEthnic.ProjectEthnicID , " & _
" tblProjectGender.ProjectGenderID ,
tblProjectAgeGroup.ProjectAgeGroupID " & _
" FROM tblProjectArea, tblProjectLSM, tblProjectEthnic,
tblProjectGender, tblProjectAgeGroup " & _
" WHERE (((tblProjectLSM.ProjectID) = [Forms]![frmSampleBuilder]!
[ProjectID ])) "
Thanks
Heather