Too Few parameters. Expected 2. (3061) - Northwind DB - Please Help

  • Follow


I am a newbie when it comes to access, so I beg you to be patient. I
downloaded the Northwind 2007 db and made some adjustments. My goal is to
allow persons logging into the db to only customer records to which they are
assigned and administrators should view all records. I used the following as
criteria on the Customer Extended query...

Like IIf([TempVars]![CurrentUserLevel]=4,"*",[TempVars]![CurrentUserID]). The
query works fine and filters the records when I run it in access.

When I go back to the Order Details page and choose a customer I get the
error...

Too Few parameters. Expected 2. (3061)
RecordsetWrapper.OpenRecordset

strSQL =  "SELECT * FROM [Customers Extended] WHERE [ID] = 52"

There is a module called RecordsetWrapper in NOrthwind and this is where the
error is pointing.

I have included the SQL from my query below and also the code for the
RecordsetWrapper OpenRecordset function.

I need your help URGENTLY.


CUSTOMERS EXTENDED QUERY
==========================

SELECT IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]
),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])) AS
[File As], IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First
Name]),IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]))
AS [Contact Name], Customers.*, Customers.[PTS ID]
FROM Customers LEFT JOIN [Benefits Profile] ON Customers.ID = [Benefits
Profile].[Customer ID]
WHERE (((Customers.[PTS ID]) Like IIf([TempVars]![CurrentUserLevel]=4,"*",
[TempVars]![CurrentUserID])))
ORDER BY IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First
Name]),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])
), IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),
IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]));

RECORDSETWRAPPER OpenRecordset Function
=====================================

Public Function OpenRecordset(Domain As String, _
                              Optional Criteria As String = "1=1", _
                              Optional OrderBy As String, _
                              Optional RecordsetType As DAO.RecordsetTypeEnum
= dbOpenDynaset, _
                              Optional RecordsetOptions As DAO.
RecordsetOptionEnum _
                              ) As Boolean
    
    
    If Not m_rs Is Nothing Then
        ' Close the recordset so it can be re-used
        CloseRecordset
    End If
    
    Dim strSQL As String
    strSQL = "SELECT * FROM [" & Domain & "] WHERE " & Criteria
    
     
    If OrderBy <> "" Then
        strSQL = strSQL & " ORDER BY " & OrderBy
    End If
    
    On Error GoTo ErrorHandler
    Set m_rs = CurrentDb.OpenRecordset(strSQL, RecordsetType,
RecordsetOptions)
    OpenRecordset = True

Done:
    Exit Function
ErrorHandler:
    ' verify the private Recordset object was not set
    Debug.Assert m_rs Is Nothing
    
    ' Resume statement will be hit when debugging
    If eh.LogError("RecordsetWrapper.OpenRecordset", "strSQL = " & Chr(34) &
strSQL & Chr(34)) Then Resume
End Function

0
Reply jermaine123 11/28/2009 4:38:37 AM

I'm not using Access 2007, so don't know where the OpenRecordset function is
called, but you'll need to  evaluate the query's parameters within the
function.  But as you are also applying a further criterion you'll firstly
have to open a recordset based on the query, and then filter this to open
another recordset by putting something along these lines:

    Dim dbs As DAO.Database
    Dim rstTemp As DAO.Recordset
    Dim prm As DAO.Parameter
    Dim qdf As DAO.QueryDef
    
    Set dbs = CurrentDb
    Set qdf = dbs.QueryDefs(Domain)
    
    For Each prm In qdf.Parameters
        prm = Eval(prm.Name)
    Next prm
    
    Set rstTemp = qdf.OpenRecordset
    rstTemp.Filter = Criteria
    Set m_rs = rstTemp.OpenRecordset

in place of the 'Set m_rs = CurrentDb.OpenRecordset(strSQL, RecordsetType,
RecordsetOptions)' line.

Now this would be OK if the function were only to be called with a query
passed into it as the Domain argument, but if in another context a table
where to be passed in it would result in an error.  It would be possible to
expand the code further to handle the error, but it might be simpler to write
a separate version of the function under a different name specifically for
use where a query with parameters is being passed into the function.

This does assume that the parameters [TempVars]![CurrentUserLevel] and
[TempVars]![CurrentUserID] are available for evaluation when the function is
called of course.

Ken Sheridan
Stafford, England

jermaine123 wrote:
>I am a newbie when it comes to access, so I beg you to be patient. I
>downloaded the Northwind 2007 db and made some adjustments. My goal is to
>allow persons logging into the db to only customer records to which they are
>assigned and administrators should view all records. I used the following as
>criteria on the Customer Extended query...
>
>Like IIf([TempVars]![CurrentUserLevel]=4,"*",[TempVars]![CurrentUserID]). The
>query works fine and filters the records when I run it in access.
>
>When I go back to the Order Details page and choose a customer I get the
>error...
>
>Too Few parameters. Expected 2. (3061)
>RecordsetWrapper.OpenRecordset
>
>strSQL =  "SELECT * FROM [Customers Extended] WHERE [ID] = 52"
>
>There is a module called RecordsetWrapper in NOrthwind and this is where the
>error is pointing.
>
>I have included the SQL from my query below and also the code for the
>RecordsetWrapper OpenRecordset function.
>
>I need your help URGENTLY.
>
>CUSTOMERS EXTENDED QUERY
>==========================
>
>SELECT IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]
>),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])) AS
>[File As], IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First
>Name]),IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]))
>AS [Contact Name], Customers.*, Customers.[PTS ID]
>FROM Customers LEFT JOIN [Benefits Profile] ON Customers.ID = [Benefits
>Profile].[Customer ID]
>WHERE (((Customers.[PTS ID]) Like IIf([TempVars]![CurrentUserLevel]=4,"*",
>[TempVars]![CurrentUserID])))
>ORDER BY IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First
>Name]),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name])
>), IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),
>IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]));
>
>RECORDSETWRAPPER OpenRecordset Function
>=====================================
>
>Public Function OpenRecordset(Domain As String, _
>                              Optional Criteria As String = "1=1", _
>                              Optional OrderBy As String, _
>                              Optional RecordsetType As DAO.RecordsetTypeEnum
>= dbOpenDynaset, _
>                              Optional RecordsetOptions As DAO.
>RecordsetOptionEnum _
>                              ) As Boolean
>    
>    
>    If Not m_rs Is Nothing Then
>        ' Close the recordset so it can be re-used
>        CloseRecordset
>    End If
>    
>    Dim strSQL As String
>    strSQL = "SELECT * FROM [" & Domain & "] WHERE " & Criteria
>    
>     
>    If OrderBy <> "" Then
>        strSQL = strSQL & " ORDER BY " & OrderBy
>    End If
>    
>    On Error GoTo ErrorHandler
>    Set m_rs = CurrentDb.OpenRecordset(strSQL, RecordsetType,
>RecordsetOptions)
>    OpenRecordset = True
>
>Done:
>    Exit Function
>ErrorHandler:
>    ' verify the private Recordset object was not set
>    Debug.Assert m_rs Is Nothing
>    
>    ' Resume statement will be hit when debugging
>    If eh.LogError("RecordsetWrapper.OpenRecordset", "strSQL = " & Chr(34) &
>strSQL & Chr(34)) Then Resume
>End Function

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1

0
Reply KenSheridan 11/28/2009 1:50:20 PM


PS:  You might be interested in my demo of the sort of 'row level security'
which you are aiming at.  Its available from:

http://community.netscape.com/n/pfx/forum.aspx?tsn=1&nav=libraryMessages&webtag=ws-msdevapps&tid=24069


It allows different groups of users to be given access to different rows, and
different users to be members of one or more group.  It was originally
written with Access's 'User and Group Security' in mind, but that's no longer
available in Access 2007 of course; but the principles still apply.

Ken Sheridan
Stafford, England

-- 
Message posted via http://www.accessmonster.com

0
Reply KenSheridan 11/28/2009 1:59:21 PM

Thanks Ken,

I have to run out a bit. I am going to look  look at the demo and the code
you sent and reply in a little while.
Jermaine

KenSheridan wrote:
>PS:  You might be interested in my demo of the sort of 'row level security'
>which you are aiming at.  Its available from:
>
>http://community.netscape.com/n/pfx/forum.aspx?tsn=1&nav=libraryMessages&webtag=ws-msdevapps&tid=24069
>
>It allows different groups of users to be given access to different rows, and
>different users to be members of one or more group.  It was originally
>written with Access's 'User and Group Security' in mind, but that's no longer
>available in Access 2007 of course; but the principles still apply.
>
>Ken Sheridan
>Stafford, England

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1

0
Reply jermaine123 11/28/2009 4:08:43 PM

Ken,

I have tried the code you sent but I was unable to get it working. I kept
getting the error ..

" is not a valid name. Make sure it does not include invalid characters or
punctuations that are too long (3125). 
RecordsetWrapper.OpenRecordset

strSQL =  "SELECT * FROM [Customers Extended] WHERE [ID] = 52"


Could you please give me a quick overview of how to implement your demo in
Access 2007?

jermaine123 wrote:
>Thanks Ken,
>
>I have to run out a bit. I am going to look  look at the demo and the code
>you sent and reply in a little while.
>Jermaine
>
>>PS:  You might be interested in my demo of the sort of 'row level security'
>>which you are aiming at.  Its available from:
>[quoted text clipped - 8 lines]
>>Ken Sheridan
>>Stafford, England

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1

0
Reply jermaine123 11/29/2009 9:36:17 AM

Jermaine:

Firstly, as regards my demo file, not using Access 2007 myself I can't say
for certain whether there are any issues or not,  but I'd have thought it
would convert without any problems.  I've had no feedback to suggest the
contrary at any rate.

You'll see that it contains the following function in the basSecDemo module:

Public Function GetCurrentUser() As String

    On Error Resume Next
    GetCurrentUser = [Forms]![frmLogin]![cboUserName]
    
End Function

In the demo this gets the name from the frmLogin form which remains open, but
hidden, throughout the application.  This is just a simulation of course as
anyone can log in as any user in the demo; which of course is how it
demonstrates how the records returned are restricted on the basis of
different users' logging in.  You are storing the user names some other way
by the look of it, so you'd just have to amend the above function so that it
gets the name of the current user from wherever you are obtaining it.

You'd need to include the Users, UserGroups and UserGroupsMembership tables
in your database, but these can just be imported, along with the
relationships between them, from my demo, emptied, and then filled with your
own data.  And you'd need to add the UserGroupFlag column to your principle
table.

Turning to your current problem, opening the recordset could probably be
simplified by writing a smaller function than the built in OpenRecordset
function.  Essentially all you seem to be doing is opening a recordset based
on your Customers Extended query, restricting it on the ID column.  So if you
can explain where the ID value is obtained from, i.e. what is passed into the
function as its Criteria argument, I could probably come up with a simplified
function which would do the job based on your query.

Ken Sheridan
Stafford, England

jermaine123 wrote:
>Ken,
>
>I have tried the code you sent but I was unable to get it working. I kept
>getting the error ..
>
>" is not a valid name. Make sure it does not include invalid characters or
>punctuations that are too long (3125). 
>RecordsetWrapper.OpenRecordset
>
>strSQL =  "SELECT * FROM [Customers Extended] WHERE [ID] = 52"
>
>Could you please give me a quick overview of how to implement your demo in
>Access 2007?
>
>>Thanks Ken,
>>
>[quoted text clipped - 7 lines]
>>>Ken Sheridan
>>>Stafford, England

-- 
Message posted via http://www.accessmonster.com

0
Reply KenSheridan 11/29/2009 4:15:33 PM

Thanks for your help Ken,

Regarding my current problem,

On the Order Details form there is a combobox (named: Customer ID) that is
linked to the Customer ID field in the Customer Extended query. This combo
box allows you to choose the customer for which you want to run a transaction.
The code in the update event  of this combobox is...

Private Sub Customer_ID_AfterUpdate()
    SetFormState False

    If Not IsNull(Me![Customer ID]) Then
        SetDefaultShippingAddress
    End If
   
End Sub

When a customer is chosen it automatically fills in the Shipping Addess for
the Customer. You will see that it calls the SetDefaultShippingAddress()
function which then calls OpenRecordset(). This is where it tries to pass in
the ID value obtained from the combobox above. The SetDefaultShippingAddress
function code is below...

Sub SetDefaultShippingAddress()
    If IsNull(Me![Customer ID]) Then
        ClearShippingAddress
    Else
        
        Dim rsw As New RecordsetWrapper
        If rsw.OpenRecordset("Customers Extended", "[ID] = " & Me.Customer_ID)
Then
            With rsw.Recordset
                Me![Ship Name] = ![Contact Name]
                Me![Ship Address] = ![Address]
                Me![Ship City] = ![City]
                Me![Ship State/Province] = ![State/Province]
                Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
                Me![Ship Country/Region] = ![Country/Region]
            End With
        End If
    End If
End Sub

NB: When I log in I create 2 temporary global variables [TempVars]!
[CurrentUserLevel] and [TempVars]![CurrentUserID] which I use to filter the
Customers Extended query

Hope my explanation makes sense. 

Thanks Again,

Jermaine

KenSheridan wrote:
>Jermaine:
>
>Firstly, as regards my demo file, not using Access 2007 myself I can't say
>for certain whether there are any issues or not,  but I'd have thought it
>would convert without any problems.  I've had no feedback to suggest the
>contrary at any rate.
>
>You'll see that it contains the following function in the basSecDemo module:
>
>Public Function GetCurrentUser() As String
>
>    On Error Resume Next
>    GetCurrentUser = [Forms]![frmLogin]![cboUserName]
>    
>End Function
>
>In the demo this gets the name from the frmLogin form which remains open, but
>hidden, throughout the application.  This is just a simulation of course as
>anyone can log in as any user in the demo; which of course is how it
>demonstrates how the records returned are restricted on the basis of
>different users' logging in.  You are storing the user names some other way
>by the look of it, so you'd just have to amend the above function so that it
>gets the name of the current user from wherever you are obtaining it.
>
>You'd need to include the Users, UserGroups and UserGroupsMembership tables
>in your database, but these can just be imported, along with the
>relationships between them, from my demo, emptied, and then filled with your
>own data.  And you'd need to add the UserGroupFlag column to your principle
>table.
>
>Turning to your current problem, opening the recordset could probably be
>simplified by writing a smaller function than the built in OpenRecordset
>function.  Essentially all you seem to be doing is opening a recordset based
>on your Customers Extended query, restricting it on the ID column.  So if you
>can explain where the ID value is obtained from, i.e. what is passed into the
>function as its Criteria argument, I could probably come up with a simplified
>function which would do the job based on your query.
>
>Ken Sheridan
>Stafford, England
>
>>Ken,
>>
>[quoted text clipped - 15 lines]
>>>>Ken Sheridan
>>>>Stafford, England

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1

0
Reply jermaine123 11/30/2009 1:27:45 PM

You should be able to do it the way I described by first establishing one
recordset based on the query and then another by filtering it:

Sub SetDefaultShippingAddress()

   If IsNull(Me![Customer ID]) Then
       ClearShippingAddress
   Else
       Dim dbs AS DAO.Database   
       Dim rstAll as DAO.Recordset
       Dim rstFiltered as DAO.Recordset
       Dim qdf as DAO.Querydef
       Dim prm As DAO.Parameter
 
       Set dbs = CurrentDb
       Set qdf = dbs.QueryDefs("Customers Extended")

       For Each prm in qdf.Parameters
           prm = Eval(prm.Name)
       Next prm

       Set rstAll = qdf.OpenRecordset
       rstAll.Filter = "ID = " & Me.Customer_ID
       Set rstFiltered= rstAll.OpenRecordset

       With rstFiltered
           Me![Ship Name] = ![Contact Name]
           Me![Ship Address] = ![Address]
           Me![Ship City] = ![City]
           Me![Ship State/Province] = ![State/Province]
           Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
           Me![Ship Country/Region] = ![Country/Region]
       End With
   End If

End Sub

Ken Sheridan
Stafford, England

jermaine123 wrote:
>Thanks for your help Ken,
>
>Regarding my current problem,
>
>On the Order Details form there is a combobox (named: Customer ID) that is
>linked to the Customer ID field in the Customer Extended query. This combo
>box allows you to choose the customer for which you want to run a transaction.
>The code in the update event  of this combobox is...
>
>Private Sub Customer_ID_AfterUpdate()
>    SetFormState False
>
>    If Not IsNull(Me![Customer ID]) Then
>        SetDefaultShippingAddress
>    End If
>   
>End Sub
>
>When a customer is chosen it automatically fills in the Shipping Addess for
>the Customer. You will see that it calls the SetDefaultShippingAddress()
>function which then calls OpenRecordset(). This is where it tries to pass in
>the ID value obtained from the combobox above. The SetDefaultShippingAddress
>function code is below...
>
>Sub SetDefaultShippingAddress()
>    If IsNull(Me![Customer ID]) Then
>        ClearShippingAddress
>    Else
>        
>        Dim rsw As New RecordsetWrapper
>        If rsw.OpenRecordset("Customers Extended", "[ID] = " & Me.Customer_ID)
>Then
>            With rsw.Recordset
>                Me![Ship Name] = ![Contact Name]
>                Me![Ship Address] = ![Address]
>                Me![Ship City] = ![City]
>                Me![Ship State/Province] = ![State/Province]
>                Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
>                Me![Ship Country/Region] = ![Country/Region]
>            End With
>        End If
>    End If
>End Sub
>
>NB: When I log in I create 2 temporary global variables [TempVars]!
>[CurrentUserLevel] and [TempVars]![CurrentUserID] which I use to filter the
>Customers Extended query
>
>Hope my explanation makes sense. 
>
>Thanks Again,
>
>Jermaine
>
>>Jermaine:
>>
>[quoted text clipped - 42 lines]
>>>>>Ken Sheridan
>>>>>Stafford, England

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1

0
Reply KenSheridan 11/30/2009 9:57:37 PM

Hi,

I have not read through the thread but I have found on several occasions the 
same error code.  What I have noticed in the past is whenever I try to run a 
query/sql in code and it is based on another query or queries I receive the 
"Expected two parameters or to few parameters. " When I change the query 
into a Make table query and use the resulting table as the record set my 
problem disappear.

Hennie

"KenSheridan via AccessMonster.com" <u51882@uwe> wrote in message 
news:9fe825409479c@uwe...
> You should be able to do it the way I described by first establishing one
> recordset based on the query and then another by filtering it:
>
> Sub SetDefaultShippingAddress()
>
>   If IsNull(Me![Customer ID]) Then
>       ClearShippingAddress
>   Else
>       Dim dbs AS DAO.Database
>       Dim rstAll as DAO.Recordset
>       Dim rstFiltered as DAO.Recordset
>       Dim qdf as DAO.Querydef
>       Dim prm As DAO.Parameter
>
>       Set dbs = CurrentDb
>       Set qdf = dbs.QueryDefs("Customers Extended")
>
>       For Each prm in qdf.Parameters
>           prm = Eval(prm.Name)
>       Next prm
>
>       Set rstAll = qdf.OpenRecordset
>       rstAll.Filter = "ID = " & Me.Customer_ID
>       Set rstFiltered= rstAll.OpenRecordset
>
>       With rstFiltered
>           Me![Ship Name] = ![Contact Name]
>           Me![Ship Address] = ![Address]
>           Me![Ship City] = ![City]
>           Me![Ship State/Province] = ![State/Province]
>           Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
>           Me![Ship Country/Region] = ![Country/Region]
>       End With
>   End If
>
> End Sub
>
> Ken Sheridan
> Stafford, England
>
> jermaine123 wrote:
>>Thanks for your help Ken,
>>
>>Regarding my current problem,
>>
>>On the Order Details form there is a combobox (named: Customer ID) that is
>>linked to the Customer ID field in the Customer Extended query. This combo
>>box allows you to choose the customer for which you want to run a 
>>transaction.
>>The code in the update event  of this combobox is...
>>
>>Private Sub Customer_ID_AfterUpdate()
>>    SetFormState False
>>
>>    If Not IsNull(Me![Customer ID]) Then
>>        SetDefaultShippingAddress
>>    End If
>>
>>End Sub
>>
>>When a customer is chosen it automatically fills in the Shipping Addess 
>>for
>>the Customer. You will see that it calls the SetDefaultShippingAddress()
>>function which then calls OpenRecordset(). This is where it tries to pass 
>>in
>>the ID value obtained from the combobox above. The 
>>SetDefaultShippingAddress
>>function code is below...
>>
>>Sub SetDefaultShippingAddress()
>>    If IsNull(Me![Customer ID]) Then
>>        ClearShippingAddress
>>    Else
>>
>>        Dim rsw As New RecordsetWrapper
>>        If rsw.OpenRecordset("Customers Extended", "[ID] = " & 
>> Me.Customer_ID)
>>Then
>>            With rsw.Recordset
>>                Me![Ship Name] = ![Contact Name]
>>                Me![Ship Address] = ![Address]
>>                Me![Ship City] = ![City]
>>                Me![Ship State/Province] = ![State/Province]
>>                Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
>>                Me![Ship Country/Region] = ![Country/Region]
>>            End With
>>        End If
>>    End If
>>End Sub
>>
>>NB: When I log in I create 2 temporary global variables [TempVars]!
>>[CurrentUserLevel] and [TempVars]![CurrentUserID] which I use to filter 
>>the
>>Customers Extended query
>>
>>Hope my explanation makes sense.
>>
>>Thanks Again,
>>
>>Jermaine
>>
>>>Jermaine:
>>>
>>[quoted text clipped - 42 lines]
>>>>>>Ken Sheridan
>>>>>>Stafford, England
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200911/1
> 
0
Reply hennie 12/2/2009 1:28:57 AM

Ken,

That works perfectly. You are the Master of your domain. This site is the
best

Thanks again

Jermaine

KenSheridan wrote:
>You should be able to do it the way I described by first establishing one
>recordset based on the query and then another by filtering it:
>
>Sub SetDefaultShippingAddress()
>
>   If IsNull(Me![Customer ID]) Then
>       ClearShippingAddress
>   Else
>       Dim dbs AS DAO.Database   
>       Dim rstAll as DAO.Recordset
>       Dim rstFiltered as DAO.Recordset
>       Dim qdf as DAO.Querydef
>       Dim prm As DAO.Parameter
> 
>       Set dbs = CurrentDb
>       Set qdf = dbs.QueryDefs("Customers Extended")
>
>       For Each prm in qdf.Parameters
>           prm = Eval(prm.Name)
>       Next prm
>
>       Set rstAll = qdf.OpenRecordset
>       rstAll.Filter = "ID = " & Me.Customer_ID
>       Set rstFiltered= rstAll.OpenRecordset
>
>       With rstFiltered
>           Me![Ship Name] = ![Contact Name]
>           Me![Ship Address] = ![Address]
>           Me![Ship City] = ![City]
>           Me![Ship State/Province] = ![State/Province]
>           Me![Ship ZIP/Postal Code] = ![ZIP/Postal Code]
>           Me![Ship Country/Region] = ![Country/Region]
>       End With
>   End If
>
>End Sub
>
>Ken Sheridan
>Stafford, England
>
>>Thanks for your help Ken,
>>
>[quoted text clipped - 55 lines]
>>>>>>Ken Sheridan
>>>>>>Stafford, England

-- 
Message posted via http://www.accessmonster.com

0
Reply jermaine123 12/2/2009 7:32:19 AM

Thanks for the tip hennie

hennie wrote:
>Hi,
>
>I have not read through the thread but I have found on several occasions the 
>same error code.  What I have noticed in the past is whenever I try to run a 
>query/sql in code and it is based on another query or queries I receive the 
>"Expected two parameters or to few parameters. " When I change the query 
>into a Make table query and use the resulting table as the record set my 
>problem disappear.
>
>Hennie
>
>> You should be able to do it the way I described by first establishing one
>> recordset based on the query and then another by filtering it:
>[quoted text clipped - 101 lines]
>>>>>>>Ken Sheridan
>>>>>>>Stafford, England

-- 
Message posted via http://www.accessmonster.com

0
Reply jermaine123 12/2/2009 7:34:19 AM

10 Replies
365 Views

(page loaded in 1.355 seconds)

Similiar Articles:
















7/20/2012 3:30:43 PM


Reply: