[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Access 2003 Query Parameter Type Decimal

Asked by rmk in Microsoft Access Database

I have an Access 2003 table that is linked to a DB2 table. When I look at the table in design view, I see a column called JGLAN defined as Number with FieldSize=Decimal, Precision=15, and Scale=0.
Since the Decimal parameter data type does not seem to be supported in the Access 2003 UI for queries, I tried setting it to Value as follows:
PARAMETERS [@CONO] Long, [@GLAN1] Value, [@GLAN2] Value;
SELECT CMSFIL_APPCHK.JGLAN, Count("*") AS [Count]
FROM CMSFIL_APPCHK
WHERE (((CMSFIL_APPCHK.JGLAN)=[@GLAN1] Or (CMSFIL_APPCHK.JGLAN)=[@GLAN2]) AND ((CMSFIL_APPCHK.JCONO)<>[@CONO]))
GROUP BY CMSFIL_APPCHK.JGLAN
ORDER BY CMSFIL_APPCHK.JGLAN;

In my data access layer I define these paramters as decimal as shown below:
Public Function CMSFIL_APPCHK_SelectCountForNotCoNoGLANs _
    ( _
        ByVal vlngNotCoNo As Long, _
        ByVal vstrGLAN1 As String, _
        ByVal vstrGLAN2 As String _
    ) As ADODB.Recordset

    On Error GoTo Proc_Err
    'If gerh.OnErrorGoto0 Then On Error GoTo 0
   
    Const strcProc  As String = "CMSFIL_APPCHK_SelectCountForNotCoNoGLANs"
   
    Dim cmd         As ADODB.Command
    Dim prm         As ADODB.Parameter
   
    Dim ct          As RMKCallTrace
   
    Set ct = NewRMKCallTrace(strcProc, mstrcModule)
    Set cmd = New ADODB.Command
    With cmd
        .CommandType = adCmdStoredProc
        .CommandText = mcproc & strcProc
        If mfSupportsReturnValue Then
            .Parameters.Append .CreateParameter(, adInteger, adParamReturnValue)
        End If
        .Parameters.Append .CreateParameter(mcprm & "CONO", adInteger, adParamInput, , vlngNotCoNo)
        '
        Set prm = New ADODB.Parameter
        prm.Name = mcprm & "GLAN1"
        prm.Type = adDecimal
        prm.Precision = 15
        prm.NumericScale = 0
        prm.Direction = adParamInput
        prm.Value = CDec(vstrGLAN1)
        .Parameters.Append prm
        Set prm = Nothing
        '
        Set prm = New ADODB.Parameter
        prm.Name = mcprm & "GLAN2"
        prm.Type = adDecimal
        prm.Precision = 15
        prm.NumericScale = 0
        prm.Direction = adParamInput
        prm.Value = CDec(vstrGLAN1)
        .Parameters.Append prm
        Set prm = Nothing
        '
        Set CMSFIL_APPCHK_SelectCountForNotCoNoGLANs = GetRecordset(cmd)
    End With
    Set cmd = Nothing
   
Proc_Exit:
    Exit Function
   
Proc_Err:
    VBA.Err.Raise Err.Number, mstrcModule & "." & strcProc & vbNewLine & Err.Source
End Function

The query never returns any reconds using the data access layer, but it does return records if I use the Access 2003 UI.

How should I define the query parameters in the QueryDel and in the data access lauer so this will work?
[+][-]08/12/09 11:38 AM, ID: 25081456Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Microsoft Access Database
Sign Up Now!
Solution Provided By: rmk
Participating Experts: 2
Solution Grade: A
 
[+][-]08/11/09 03:35 AM, ID: 25067541Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/11/09 04:09 AM, ID: 25067699Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/11/09 06:17 AM, ID: 25068623Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/11/09 06:20 AM, ID: 25068659Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/11/09 07:53 AM, ID: 25069754Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93 - Hierarchy / EE_QW_3_20080625