A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Running query from Access Form commmand using VBA code



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 8th 06, 03:37 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.outlook.program_vba
Berny
external usenet poster
 
Posts: 3
Default Running query from Access Form commmand using VBA code

I'm trying to run an append query using VBA code but can seem to get it to
work.

Can someone tell me if this is even possible?

Below is the query I'm trying to run:

INSERT INTO tblPastDueUpload ( PdWoNo, PdWoDesc1, PdWoDesc2, PdWoDesc3,
PdDateChk, PdPty, PdWoCls )
SELECT tblReviewWorkOrders.WoNo, Left(tblReviewWorkOrders!WoDesc,40) AS
WoDesc1,
IIf(Len(RTrim(tblReviewWorkOrders!WoDesc))40,Mid( tblReviewWorkOrders!WoDesc,41,60),"
") AS WoDesc2,
IIf(Len(RTrim(tblReviewWorkOrders!WoDesc))100,Mid (tblReviewWorkOrders!WoDesc,101,60),"
") AS WoDesc3,
IIf(tblReviewWorkOrders!EstComp(Date()+30),(Date( )+45),tblReviewWorkOrders!EstComp)
AS DateChk, tblReviewWorkOrders.Pty, IIf([ActHrs]20,"B",[SrvCat]) AS WoCls
FROM tblReviewWorkOrders
WHERE (((tblReviewWorkOrders.Bklg)="ad3") AND
((tblReviewWorkOrders.Status)"07") AND
((tblReviewWorkOrders.EstComp)Date()) AND
((tblReviewWorkOrders.TotalCost)[tblReviewWorkOrders]![Authorized]-50) AND
((tblReviewWorkOrders.blnExclude)=0) AND
((Left([tblReviewWorkOrders]![WoNo],1)) Like "l" Or
(Left([tblReviewWorkOrders]![WoNo],1))="m" Or
(Left([tblReviewWorkOrders]![WoNo],1))="v") AND
((tblReviewWorkOrders.CatCode) Not Like "*pwo*") AND
((tblReviewWorkOrders.UserField2) Not Like "wp*"))
ORDER BY tblReviewWorkOrders.WoNo;

I was trying to use code similar to below but can get it to work

strSql = ***I can't get any code in this area to work, any suggestions? ***
DoCmd.SetWarnings False
DoCmd.RunSQL strSql

Any help would be greatly appreciated.




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA shortcut to open custom form in design mode? Burma Jones Outlook - Using Forms 2 March 6th 06 07:17 PM
Outlook not displaying attachment from Access via code [email protected] Outlook - General Queries 4 February 27th 06 11:30 PM
how to apply vba code to OL2003 forms ? TimR Outlook - Using Contacts 1 February 17th 06 04:41 PM
Delete Custom Outlook Control thru Access VBA Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 05:29 PM
Need code for appointment form Colin Coady Outlook - Using Forms 0 January 18th 06 01:21 PM


All times are GMT +1. The time now is 07:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.