|
-
Feb 22nd, 2008, 06:49 AM
#1
Thread Starter
New Member
problem writing report
i have database which have two tables (customers & table1)
customer has two field customerid & customername
table1 has eight field in which two field are customerid and date
my problem is this when i retrive data of a customerid between datefrom to dateto in datagrid it will show the data beween datefrom to dateto
but when i am trying to make report acording to this criteria then report shows all the data of that customerid from start to end NOT show between datefrom to dateto
i am using this sql statement to retrive data in datagrid
{"SELECT * FROM Table1, Customers WHERE Customers.CustomerID =Table1.CustomerID AND Table1.CustomerID =" & Customerid & " and Table1.Date between #" & dtFrom & "# and #" & dtTo & "# ORDER BY Table1.DATE"}
is any one can help me in this problem
-
Feb 22nd, 2008, 08:19 AM
#2
Re: problem writing report
Are you using VB6 or VB.NET?
-
Feb 22nd, 2008, 08:47 AM
#3
Thread Starter
New Member
Re: problem writing report
i am using visual basic 6 and for database i use access 97
-
Feb 22nd, 2008, 08:56 AM
#4
Re: problem writing report
Then put two option buttons on your VB6 form.
Call one of the optAll and put in the caption "All Records"
Call the other one optDates and put in the caption "Select Date Range"
Then in your code do something like
Code:
If optDates.Value = True Then
{"SELECT * FROM Table1, Customers WHERE Customers.CustomerID =Table1.CustomerID AND Table1.CustomerID =" & Customerid & " and Table1.Date between #" & dtFrom & "# and #" & dtTo & "# ORDER BY Table1.DATE"}
Else
{"SELECT * FROM Table1, Customers WHERE Customers.CustomerID =Table1.CustomerID AND Table1.CustomerID =" & Customerid
End If
-
Feb 22nd, 2008, 09:19 AM
#5
Thread Starter
New Member
Re: problem writing report
i use this code in viewing the data for customerid
but in report print the data show in datagrid does not same in report
in report show all data of that customerid NOT equal to the datagrid
-
Feb 22nd, 2008, 10:35 AM
#6
Re: problem writing report
HI,
Are you using CR or data report?
greg
-
Feb 22nd, 2008, 10:37 AM
#7
Re: problem writing report
If your using data report, you may use hack's sql statement suggestion to view your report.
Greg
-
Feb 22nd, 2008, 12:30 PM
#8
Re: problem writing report
You have very little control over what is shown in a bound DataGrid.
Because it is a bound control, and therefore, linked to a table, it is going to display everything in the table.
If you need, for display purposes, only a subset of your records, then you would be much better off changing from using a datagrid to an unbound control like a flexgrid or a ListView.
-
Feb 22nd, 2008, 01:11 PM
#9
Re: problem writing report
What are you using for the DataSource Property of your report. Are you using a DE , ADO recordset or MSDataShape?
-
Feb 23rd, 2008, 12:58 AM
#10
Thread Starter
New Member
Re: problem writing report
I try to use both CR 8 And Datareport
but both have same problems
and i am using ADODB recordset
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
|