UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Need A Quick Code Check, It's Only 10 Lines...., Office 2007    
 
   
David92595
post Apr 11 2012, 07:12 PM
Post #1

UtterAccess Addict
Posts: 247



Hello, some where in here there is something wrong with my code. I'm trying to run some vb to push to a Access 2007 pass-through query connected to a SQL Server.
Per_Diem_Calculator is the name of the query and usp query on the sql side. Forms![NewOrdersCa]![TS] is essentially the current ID number on the form I'm viewing to compare to a variable I created on the SQL side.


CODE:
Dim DB As Database
Dim A As QueryDef

Set DB = CurrentDb()
Set A = DB.QueryDefs(Per_Diem_Calculator_CA)
A.SQL = "exec dbo.usp_Per_Diem_Calculator_CA & " '" & Forms![NewOrdersCa]![TS] & "'"

DoCmd.OpenQuery "Per_Diem_Calculator_CA"


Thank you!
David92595
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 5)
GroverParkGeorge
post Apr 11 2012, 07:20 PM
Post #2

UA Admin
Posts: 19,247
From: Newcastle, WA



What is happening that shouldn't be, or what is not happening that should be?

What does the stored proc look like?

"Forms![NewOrdersCa]![TS] is essentially the current ID number on the form I'm viewing to compare to a variable I created on the SQL side. "

hm. Either it IS the current ID or it IS NOT the current ID.
Go to the top of the page
 
+
David92595
post Apr 11 2012, 08:11 PM
Post #3

UtterAccess Addict
Posts: 247



It should be passing "exec dbo.usp_Per_Diem_Calculator_CA 'ID' "to a pass through query. but every time I run it nothing happends, the query isn't run; and when I look at the details of the query there is only a ":" in the pass through query.

Forms![NewOrdersCa]![TS] IS the current ID.
Go to the top of the page
 
+
GroverParkGeorge
post Apr 11 2012, 10:42 PM
Post #4

UA Admin
Posts: 19,247
From: Newcastle, WA



This line should be

Set A = DB.QueryDefs("Per_Diem_Calculator_CA")
Go to the top of the page
 
+
David92595
post Apr 12 2012, 12:19 PM
Post #5

UtterAccess Addict
Posts: 247



THANK YOU!!!! (IMG:style_emoticons/default/woohoo.gif)

I knew it was some small little typo like that.

I need to remember those quotation marks...

I can't thank you enough, I'm the only programer at my company so I don't have a second set of eye to check my work. (IMG:style_emoticons/default/crazy.gif)

Thanks again,
David92595
Go to the top of the page
 
+
GroverParkGeorge
post Apr 12 2012, 01:49 PM
Post #6

UA Admin
Posts: 19,247
From: Newcastle, WA



Congratulations on resolving your problem. Continued success with your project.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 09:13 PM