|
-
Aug 30th, 2005, 08:08 AM
#1
Thread Starter
Hyperactive Member
[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.
-
Aug 30th, 2005, 08:16 AM
#2
Re: Runtime positions and stuff
 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.
 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.
-
Aug 30th, 2005, 08:29 AM
#3
Thread Starter
Hyperactive Member
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:
Dim oRs As ADODB.Recordset
Dim i As Integer
Set oRs = New ADODB.Recordset
oRs.Open "Select * From Param", connString, adOpenStatic, adLockBatchOptimistic, adCmdText
With rptStockTake
Set .DataSource = oRs
.DataMember = oRs.DataMember
.Sections("Section4").Controls("Label1").Caption = oRs("LicName")
.Sections("Section4").Controls("lblAddress").Caption = oRs("Address1")
& vbCrLf & oRs("Address2") & vbCrLf & oRs("Address3") & vbCrLf & oRs
("Address4")
.Show
End With
Set oRs = New ADODB.Recordset
oRs.Open "SELECT CategoryPOS.Name, Product.NameShort,
Product.NameLong, Product.Location From CategoryPOS INNER JOIN
Product ON CategoryPOS.POSCatID = Product.POSCatID Order By
Product.NameShort ASC", connString, adOpenStatic,
adLockBatchOptimistic, adCmdText
With rptStockTake
Set .DataSource = oRs
.DataMember = oRs.DataMember
.Sections("Section5").Controls("lblRecCount").Caption =
oRs.RecordCount & " items listed"
With oRs
i = 1
Do Until oRs.EOF = True
![NameShort] = oRs("NameShort")
![NameLong] = oRs("NameLong")
![Location] = oRs("Location")
![Name] = oRs("Name")
i = i + 1
oRs.MoveNext
Loop
End With
.Show
'.PrintReport
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.
-
Aug 30th, 2005, 09:24 AM
#4
Re: Runtime positions and stuff
 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.
-
Aug 30th, 2005, 11:55 AM
#5
Re: Runtime positions and stuff
-
Aug 31st, 2005, 09:40 AM
#6
Thread Starter
Hyperactive Member
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")
-
Aug 31st, 2005, 10:05 AM
#7
Re: Runtime positions and stuff
 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.
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|