Results 1 to 7 of 7

Thread: [RESOLVED] Runtime positions and stuff

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    307

    Resolved [RESOLVED] Runtime positions and stuff

    Hi

    is this possible? i have a product table (with 16 fields) which i want to make a product listing report of (using datareport). i have a listview with the fields in it with a checkbox next to it. if i only select 3 checkboxes, then i only those three shown on the report. or same thing with 7 fields or whatever is checked. but it should be shown right after each other....(the columns).
    i have 3 pics included on what i mean. im using access as my database. please dont suggest crystal coz ive tried it, and i almost tore my hair out trying to figure it coz apparently i cant change the sql statement at runtime for crystal.
    Attached Images Attached Images    

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Runtime positions and stuff

    Quote Originally Posted by whythetorment
    Hi

    is this possible? i have a product table (with 16 fields) which i want to make a product listing report of (using datareport). i have a listview with the fields in it with a checkbox next to it. if i only select 3 checkboxes, then i only those three shown on the report. or same thing with 7 fields or whatever is checked. but it should be shown right after each other....(the columns).
    My first question would be how to things get sent to a datareport (never used one)? Is it bound to something? I ask because I'm not sure whether it would be easier to loop through your table and gather records that match the checked listview items, or loop through the ListView and pass whatever is checked to the datareport.
    Quote Originally Posted by whythetorment
    im using access as my database. please dont suggest crystal coz ive tried it, and i almost tore my hair out trying to figure it coz apparently i cant change the sql statement at runtime for crystal.
    You can get around this by not passing the SQL to crystal at all, but rather creating a recordset out of your SQL statement and populating a precreated table with that recordset, and to which a precreated Crystal Report is bound.

    Having said that, and asked that, I curious as to why you are using the datareport, or attempting to use Crystal, when you are using Access and could simply use Access reports.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    307

    Re: Runtime positions and stuff

    ive used this method to make a stock take report (where staff can just write down the quantity for each stock counted). and on the report ive set the rptTextBoxes to their different datafields.

    VB Code:
    1. Dim oRs As ADODB.Recordset
    2. Dim i As Integer
    3.  
    4.     Set oRs = New ADODB.Recordset
    5.     oRs.Open "Select * From Param", connString, adOpenStatic, adLockBatchOptimistic, adCmdText
    6.  
    7.     With rptStockTake
    8.         Set .DataSource = oRs
    9.         .DataMember = oRs.DataMember
    10.         .Sections("Section4").Controls("Label1").Caption = oRs("LicName")
    11.         .Sections("Section4").Controls("lblAddress").Caption = oRs("Address1")
    12.         & vbCrLf & oRs("Address2") & vbCrLf & oRs("Address3") & vbCrLf & oRs
    13.        ("Address4")
    14.         .Show
    15.     End With
    16.  
    17.         Set oRs = New ADODB.Recordset
    18.         oRs.Open "SELECT CategoryPOS.Name, Product.NameShort,
    19.         Product.NameLong, Product.Location From CategoryPOS INNER JOIN
    20.         Product ON CategoryPOS.POSCatID = Product.POSCatID Order By
    21.         Product.NameShort ASC", connString, adOpenStatic,
    22.         adLockBatchOptimistic, adCmdText
    23.        
    24.         With rptStockTake
    25.             Set .DataSource = oRs
    26.             .DataMember = oRs.DataMember
    27.             .Sections("Section5").Controls("lblRecCount").Caption =
    28.             oRs.RecordCount & " items listed"
    29.        
    30.             With oRs
    31.                 i = 1
    32.                 Do Until oRs.EOF = True
    33.                    
    34.                     ![NameShort] = oRs("NameShort")
    35.                     ![NameLong] = oRs("NameLong")
    36.                     ![Location] = oRs("Location")
    37.                     ![Name] = oRs("Name")
    38.            
    39.                     i = i + 1
    40.                     oRs.MoveNext
    41.                 Loop
    42.             End With
    43.             .Show
    44.             '.PrintReport
    45.         End With

    ive searched the net and it looked easy to do it this way. and thats how ive been using it in my other reports. ive only been creating reports for the past two weeks, so dont know much about it or even knew i could use access reports in vb. i really dont want go from datareports to access reports because my deadline is coming up very fast.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Runtime positions and stuff

    Quote Originally Posted by whythetorment
    i really dont want go from datareports to access reports because my deadline is coming up very fast.
    Deadlines are something we can all relate to.

    Ok, it looks like the DataReport thing is bound to a specific table, correct?

    If so, and you have it bound to the table that has all of your products in it, then that is what is going to be shown.

    Question two: Most bound things (if memory serves) has a Filter property. Do the datareports have that as well. If so, that would be something to explore.

    If not, then my next suggestion would be to create a temp table to which you would bind your report. Once the selections have been made from your Listview, add those records to the temp table and in that way, only those records would show up in the report.

    Naturally, if you elect this route, prior to adding the records, you would have to delete everything in the temp table so you would always have a new, fresh, set of records.

    Since you are new to this whole thing, let me see what I can find on using DataReports for you.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Runtime positions and stuff


  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    307

    Re: Runtime positions and stuff

    thanx, im am able though to create a basic report. but thanx

    i was thinking though if i write my sql statement that select which fields will be displayed, wont it be easier to output it as a string with tabs between? like
    ![NameShort] = oRs("NameShort")

    will become
    ![NameShort] = oRs("NameShort") & tab & ors("NameLong") & tab & ors("BarCode")

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Runtime positions and stuff

    Quote Originally Posted by whythetorment
    thanx, im am able though to create a basic report. but thanx
    Ok...if you run into someone just starting out, then pass those links along to them.
    Quote Originally Posted by whythetorment
    i was thinking though if i write my sql statement that select which fields will be displayed, wont it be easier to output it as a string with tabs between? like
    ![NameShort] = oRs("NameShort")

    will become
    ![NameShort] = oRs("NameShort") & tab & ors("NameLong") & tab & ors("BarCode")
    That depends on how the datareports reacts to Tab...if the datareports will take that character for what it is, then this should work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width