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 / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Select Case Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mary Bowman - 27 Apr 2005 20:59 GMT
I have the following code to send records based on the case to the form
that I have created.  I keep getting the error "variable not found"
highlighting "RcdFilter"

Any suggestions???

Private Sub ADP_Click()
 
Dim sFilter As String
Select Case RcdFilter
  Case 0
  Case 1 sFilter = "[Companyid] = '2"        
End Select
Me.Filter = sFilter
Me.FilterOn = Len(sFilter) > 0
   
     DoCmd.OpenForm "frmPreview"
End Sub
Dirk Goldgar - 27 Apr 2005 21:44 GMT
> I have the following code to send records based on the case to the
> form that I have created.  I keep getting the error "variable not
[quoted text clipped - 14 lines]
>       DoCmd.OpenForm "frmPreview"
> End Sub

I see nothing in the posted code that defines RcdFilter as a variable.
Is this a control on the form?  Is it a variable that is defined at the
module level?  Is it a global variable?

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Mary Bowman - 27 Apr 2005 21:53 GMT
RcdFilter is a tag on the form that is being opened.  I fixed the tag, but
now the form brings up all the records and not filtering.
Dirk Goldgar - 27 Apr 2005 22:11 GMT
> RcdFilter is a tag on the form that is being opened.  I fixed the
> tag, but now the form brings up all the records and not filtering.

I'm not sure what you mean when you say "RcdFilter is a tag".  However,
if you've "fixed it" in such a way that your code now compiles, then
maybe your problem comes from the fact this line:

>    Case 1 sFilter = "[Companyid] = '2"

has an unbalanced single-quote.  Assuming [Companyid] is a text field,
that line should be:

   Case 1 sFilter = "[Companyid] = '2'"

Note that, if [Companyid] is a numeric field (not text), that should
just be

   Case 1 sFilter = "[Companyid] = 2"

Also, I see that you are applying this filter to the current form, and
then opening another form.  Which form is it that you're expecting the
filter to be applied to?  You're doing nothing to apply the filter to
"frmPreview".

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Mary Bowman - 27 Apr 2005 22:52 GMT
Hooray! That did it.  I put the case on the other form.  It works.

Thanks Dick!!!
 
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.