The Code Cage - Microsoft Office help Free Microsoft Office Help for all Applications!  

To stop seeing these ads and get other benefits check This page!

Go Back   The Code Cage Forums > Members - Microsoft Topics > Members - Access Forum > Members - Access VBA Programming
  Chat In Use Now! Microsoft Office Chat Online now!


Members - Access VBA Programming Members, post questions in this forum if they are related to using Microsoft Access VBA Programming, Macro's etc.
If you recieve no reply within 1 day your thread will be reposted in the newsgroups with a redirect here.

Hey there!

It looks like you're enjoying but haven't created an account yet. Why not take a minute to register for your own free account now? As a member you get free access to all of our forums and posts plus the ability to post your own messages, communicate directly with other members and much more. Register now!

Already a member? Login at the top of this page to stop seeing this message.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 8th February 2010, 07:51 PM
Junior Member
MS Office Version: Access 2003
MS Office Skill Level: New to Access


My Top Tip Count: 0

 
Join Date: Feb 2010
Location: Bethlehem, USA
Posts: 1
Thanks to others: 0
Thanked 0 Times in 0 Posts
Chats: 0
Rep Power: 0
Jojo69 is on a distinguished road
Default Access Insert into Table

------ Register to get rid of these "In Post" ads! ------


Hi,

I have the following code to insert into a table

VBA CODE:
Sub RunQry() 
     
    Dim StrSql As String 
     
    StrSql = "SELECT AllocExpQueryRedoneMH.CategoricalId, AllocExpQueryRedoneMH.CAU, AllocExpQueryRedoneMH.Allocation, ExpenditureSumMH.SumOfExpenditure, [allocation]-ExpenditureSumMH.sumofExpenditure AS Carryover, CodesCategoricalLineItemsMH.CategoricalDescription, Mid([CAUDescription],1,InStr([CAUDescription],'" & MH & "')-2) AS County, CodesRegionOrderBy.RegionOrder into MHAllocationsExpenditures0809" _ 
    & "FROM (((AllocExpQueryRedoneMH INNER JOIN CodesCAU ON AllocExpQueryRedoneMH.CAU = CodesCAU.CAU) LEFT JOIN ExpenditureSumMH ON (AllocExpQueryRedoneMH.CAU = ExpenditureSumMH.CAU) AND (AllocExpQueryRedoneMH.CategoricalId = ExpenditureSumMH.CategoricalID)) LEFT JOIN CodesCategoricalLineItemsMH ON AllocExpQueryRedoneMH.CategoricalId = CodesCategoricalLineItemsMH.ID) INNER JOIN CodesRegionOrderBy ON CodesCAU.MHRegionCode = CodesRegionOrderBy.RegionCode" _ 
    & "GROUP BY AllocExpQueryRedoneMH.CategoricalId, AllocExpQueryRedoneMH.CAU, AllocExpQueryRedoneMH.Allocation, ExpenditureSumMH.SumOfExpenditure, [allocation]-ExpenditureSumMH.sumofExpenditure, CodesCategoricalLineItemsMH.CategoricalDescription, Mid([CAUDescription],1,InStr([CAUDescription],'" & MH & "')-2), CodesRegionOrderBy.RegionOrder" _ 
    & "ORDER BY CodesRegionOrderBy.RegionOrder;" 
     
     
    With DoCmd 
        .SetWarnings False 
        .RunSQL StrSql 
        .SetWarnings True 
    End With 
     
     
End Sub 

I get an error (runtime error 3067) Query input must contain at least one input table or query

Could someone please help me. Thank you

Ijaz

Last edited by Simon Lloyd; 8th February 2010 at 09:58 PM.
Reply With Quote


Did you find this post helpful? Yes | No

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
  #2 (permalink)  
Old 8th February 2010, 10:04 PM
Simon Lloyd's Avatar
Administrator
MS Office Version: MS Office 97, 2003, 2007
MS Office Skill Level: Can use most of MS Office


My Top Tip Count: 5

 
Join Date: Aug 2008
Location: Manchester, England
Age: 45
Posts: 1,925
Thanks to others: 3
Thanked 74 Times in 73 Posts
Chats: 657
Rep Power: 10
Simon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud ofSimon Lloyd has much to be proud of
5 Top Tips
Wales
Default Re: Access Insert into Table

------ Register to get rid of these "In Post" ads! ------


I'm no good on Access, however, i believe your tables should be wrapped in square brackets eg.
VBA CODE:
"SELECT [AllocExpQueryRedoneMH.CategoricalId],............etc 
i would double check you concatenation too!
__________________
Regards,
Simon Lloyd
Excel Chat
Reply With Quote


Did you find this post helpful? Yes | No
The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
Reply

Bookmarks

Tags
access, insert, table


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

The Code Cage Affilliates


To stop seeing these ads and get other benefits check This page!



All times are GMT +1. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2
No part of this board may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application the represent