Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:23:58+00:00 2026-06-13T15:23:58+00:00

I want to search clients that got to shop between two dates. The code

  • 0

I want to search clients that got to shop between two dates.
The code I use seems alright and it doesn’t return any error but the CR returns everything – It does not use the date search function. The CR I use is tested with a simple program that open CR and works fine.
database is ms access and code is in visual studio 2005

The second issue I have is that despite i use the connection info part it still ask me for a code
PS. sorry for my bad formatting , i am new in stackoverflow and i find it hard to make a post
thank you!
-Agisilaos

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
    Dim crConnectionInfo As New ConnectionInfo()


 Private Sub Button1_Click(ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles Button1.Click

   Dim cryRpt As New ReportDocument


cryRpt = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        cryRpt.Load("C:\Users\agis\Documents\Visual Studio 2005\Projects\new_contracts     _of_month\new_contracts _of_month\CrystalReport2.rpt",     CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)


With crConnectionInfo
        .ServerName = "C:\Users\agis\Desktop\Insurance database\Insurancemanager.mdb"
        .UserID = "Admin"
        .Password = "kos"
        .DatabaseName = "insurancemanager"
    End With

     'first parameter
    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldDefinition As ParameterFieldDefinition
    Dim crParameterValues As New ParameterValues
    Dim crParameterDiscreteValue As New ParameterDiscreteValue
    crParameterDiscreteValue.Value = Convert.ToDateTime(TextBox1.Text) 

    crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition = crParameterFieldDefinitions.Item("startdate")
    crParameterValues = crParameterFieldDefinition.CurrentValues
    crParameterValues.Add(crParameterDiscreteValue)
    crParameterValues.Clear()

    ' second parameter : 
    Dim crParameterFieldDefinitions2 As ParameterFieldDefinitions
    Dim crParameterFieldDefinition2 As ParameterFieldDefinition
    Dim crParameterValues2 As New ParameterValues
    Dim crParameterDiscreteValue2 As New ParameterDiscreteValue
    crParameterDiscreteValue2.Value = Convert.ToDateTime(TextBox2.Text)
    TextBox3.Text += "   " + crParameterDiscreteValue2.Value 
    crParameterFieldDefinitions2 = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition2 = crParameterFieldDefinitions2.Item("enddate")
    crParameterValues2 = crParameterFieldDefinition2.CurrentValues
    crParameterValues2.Clear()


    crParameterValues2.Add(crParameterDiscreteValue2)
    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2)
     CrystalReportViewer1.ReportSource = cryRpt
    CrystalReportViewer1.Refresh()
End Sub




    End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:24:01+00:00Added an answer on June 13, 2026 at 3:24 pm

    Don’t understand what exactly your problem is but I assume that you want to pass parameter to report and filter report data on those parameters also want to set run-time connection settings of crystal report.

    First create parameter field in your report (right click on parameter fields and click on add in crystal designer)
    Now go to “crystal report->report->select expert” menu in visual studio crystal report designer and set data filter condition using these parameter fields.
    For passing parameter to report use parameter name and value like this

    cryRpt.ParameterFields("parametername").CurrentValues.AddValue(objVal)
    cryRpt.ParameterFields("fromdatetime").CurrentValues.AddValue(Now)
    

    you don’t have to set any server name for ms access database better way is create dsn for your database file and use that dsn in your report so your report will never ask for database file unless data file is missing you can even create dsn programmatically at run time if want that let us know
    if you wat to set sql like server database password and login at runtime use

    repDoc.DataSourceConnections(0).SetLogon("usrID","psw")                        
    repDoc.DataSourceConnections(0).IntegratedSecurity = False
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to search two item (name=string and location=json). this search is (one input
We want to search a file to find all instances of bar that are
Some RAD tools like openobject use rich web clients. I.e. their client side code
We use Lucene.NET to implement a full text search on a clients website. The
I want to search through a html file and then get the url to
I want to search a series of files based on the files name. Here
I want to search a user from LDAP and after getting the user I
I want to search a text in a table without knowing its attributes. Example
I want to search Google Play for Android Apps inside one of my web
I want to search a php file to find all calls to a functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.