Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / November 2006

Tip: Looking for answers? Try searching our database.

pass parameter from form field to sql function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dazzle - 09 Nov 2006 17:13 GMT
I have an access database that has recently been upsized to sql 2005 - adp
front end and sql 2005 backend. I have several reports that are set up as
hyperlinks that require a field value as a parameter. When I click on the
hyperlink i get the "Enter Parameter Value' dialogue box. If i manually enter
the info the report pulls. I changed the hyperlink (as i couldn't figure out
how to pass the parameter) to a button and set the onclick event procedure as
follows:

Private Sub PrintCurrRecord_Click()
On Error GoTo Err_PrintCurrRecord_Click

   Dim stDocName As String

   stDocName = "MTLCurrRecord"
   DoCmd.OpenReport stDocName, acPreview, , , , "[Material.mtlid]='" &
Me.ID & "'"

Exit_PrintCurrRecord_Click:
   Exit Sub

Err_PrintCurrRecord_Click:
   MsgBox Err.Description
   Resume Exit_PrintCurrRecord_Click
   
End Sub

The field [ID] value is alphanumeric eg. 'A002'.

The access report is based on the following function:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[MtlCurrentRecord] (@forms___material___mtlid nvarchar
(6)
)
RETURNS TABLE
AS RETURN (SELECT Material.MtlId, Material.MTLDesc, Material.CatID,
Material.OrderID, Material.State, Material.Density, Material.SKUCost,
Material.PurchUnit, Material.SKUUnit, Material.OnHand, Material.MinStock,
Material.Allocated, Material.InProd, Material.Location, Material.NonStock,
Material.Premix, Material.LastCount, Material.Safety, Material.WhmisID,
Material.SupplierID
FROM Material
WHERE (((Material.MtlId)=@forms___material___mtlid)))

When I click the button I still get the "Enter Parameter Value" dialogue box
with a drop down following 'forms___material___mtlid???

Thank you

Signature

Shelley

Dazzle - 13 Nov 2006 21:22 GMT
I have also tried the same thing with the "[material.mtlid] = request in the
WHERE section of the command with no luck????
Signature

Shelley

> I have an access database that has recently been upsized to sql 2005 - adp
> front end and sql 2005 backend. I have several reports that are set up as
[quoted text clipped - 46 lines]
>
> Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.