|
Instead of fooling around with gateways and such, I think you could send an email to the phonenumber@provider and it will get sent to the phone, albeit this was an old tactic I used (mine was 514*******@pcs.rogers.com), or configure your email account on your phone and just send an email to that address assuming your phone can support email accounts.
|
|
|
|
|
Dear all,
I have a crystal report which has a lot of detaildections. In 3 sections there are 3 subreports. (1 subreport per section).
If there is no data available I would like to hide the section. This works perfectly for the no subreport sections.
It also works perfectly if there is no data in the whole subreport.
However in some cases the subreport also has section and if there is not data for that one particular section I would like to hide it. I can do this, but then it hides that section for all records in that subreport. I only want it for that specific section.
I hope that makes sense. If you need more info please ask.
My code is as follows:
Do While Not rs.EOF
bFound = True
With dsCVForClient
.dtPersonalDetails.Rows.Add(rs.Fields(0).Value, rs.Fields(1).Value, rs.Fields(2).Value, rs.Fields(3).Value, rs.Fields(4).Value, rs.Fields(5).Value, rs.Fields(6).Value, rs.Fields(7).Value, rs.Fields(8).Value, rs.Fields(9).Value, rs.Fields(10).Value, rs.Fields(11).Value, rs.Fields(12).Value, rs.Fields(13).Value, rs.Fields(14).Value, rs.Fields(15).Value, rs.Fields(16).Value, rs.Fields(17).Value, rs.Fields(18).Value, rs.Fields(19).Value, rs.Fields(20).Value, rs.Fields(21).Value, rs.Fields(22).Value, rs.Fields(23).Value, rs.Fields(24).Value, sClient, sVacancy, sConsultant)
rsInHouse = gCnn.Execute("select regno, tertiaryinstitute, course, duration, completed, subjects from tertiaryeducation where regno = '" & sRegNo & "'")
Do While Not rsInHouse.EOF
For i = 0 To 5
If rsInHouse.Fields(i).Value = "" Then sTertiaryEducation(i) = "Not specified" Else sTertiaryEducation(i) = rsInHouse.Fields(i).Value
Next
.dtInHouseOtherCourses.Rows.Add(sTertiaryEducation(0), sTertiaryEducation(1), sTertiaryEducation(2), sTertiaryEducation(3), sTertiaryEducation(4), sTertiaryEducation(5))
rsInHouse.MoveNext()
Loop
rsJobHistory = gCnn.Execute("select regno, company, jobtitle, datestarted, dateleft, tasks, reasonleft, duties from jobhistory where regno = '" & sRegNo & "' order by datestarted DESC")
Do While Not rsJobHistory.EOF
For i = 0 To 6
If rsJobHistory.Fields(i).Value = "" Then sJobHistory(i) = "Not specified" Else sJobHistory(i) = rsJobHistory.Fields(i).Value
Next
If rsJobHistory.Fields(7).Value <> "" Then
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current" & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4) & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6))
Else
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current", sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4), sJobHistory(5), sJobHistory(6))
End If
rsJobHistory.MoveNext()
Loop
rsReferences = gCnn.Execute("select regno, nameofreference, designation, refcompany, reftelephone, refcellphone, reportedto, verifydates, closelysupervised, supervisestaff, nostaff, howwell, relsubordinates, relcolleagues, relsuperiors, relcustomers, meetobjectives, handlepressure, accuracy, reliability, honest, honestreporting, comparitiveresults, refstrengths, refweaknesses, attendance, reason, specificskills, rehire, refspecialachievements, otherinformation, comments from refercheck where regno = '" & sRegNo & "'")
Do While Not rsReferences.EOF
For i = 0 To 31
If rsReferences.Fields(i).Value = "" Then sReferences(i) = "Not specified" Else sReferences(i) = rsReferences.Fields(i).Value
Next
If sReferences(7) = "1" Then sReferences(7) = "Yes" Else sReferences(7) = "No"
If sReferences(9) = "1" Then sReferences(9) = "Yes" Else sReferences(9) = "No"
.dtReferences.Rows.Add(sReferences(0), sReferences(1), sReferences(2), sReferences(3), sReferences(4), sReferences(5), sReferences(6), sReferences(7), sReferences(8), sReferences(9), sReferences(10), sReferences(11), sReferences(12), sReferences(13), sReferences(14), sReferences(15), sReferences(16), sReferences(17), sReferences(18), sReferences(19), sReferences(20), sReferences(21), sReferences(22), sReferences(23), sReferences(24), sReferences(25), sReferences(26), sReferences(27), sReferences(28), sReferences(29), sReferences(30), sReferences(31))
rsReferences.MoveNext()
Loop
End With
rs.MoveNext()
Loop
Many thanks
Andrew
|
|
|
|
|
What logic are you using to hide/unhide the section ?
I just don't see it.
You have to remember that when you create a "Supression" formula in Crystal, you have to make sure that you have logic to both hide (supress=true) and unhide (supress=false).
Regards,
David
|
|
|
|
|
Hi David,
Thank you for your reply.
Ok the reason you dont see it is becuase maybe my brain is on overload and I posted the section it populates the dataset. The reason being is I thought maybe it could be done there somewhere. But on second thought it cant be done there.
A short sample:
If dsCVForClient.dtPersonalDetails(0).ComputerPackages = "" Then rpt.DetailSection49.SectionFormat.EnableSuppress = True
If dsCVForClient.dtInHouseOtherCourses.Count = 0 Then rpt.DetailSection50.SectionFormat.EnableSuppress = True
To get to the subreport, i used:
rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = True
But it led to the seciont being suppressed for all the records in the subreport.
The personaldetails will only ever have 1 record for this report, but the subreports could have anything from 0 to 100 records.
|
|
|
|
|
If appears that your logic sets the suppression to "TRUE", but never sets it to "FALSE".
I think the answer is to put an Else clause and set the suppression to FALSE.
give it a try.
|
|
|
|
|
Thank you, that was a great suggestion.
The bad news is though, it didnt work. What happens then is it enabled the section for all the records again. So if the last record did have a vaule in the field it unhid the section for all the records.
For i = 0 To dsCVForClient.dtInHouseOtherCourses.Count - 1
If dsCVForClient.dtInHouseOtherCourses(i).Subjects = "" Then rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = True Else rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = False
Next
I seem to think the secret lies in the rpt.Subreports(0).ReportDefinition is there some way to talk to a record in that subreport?
|
|
|
|
|
You can write a fomula to supress the "detail" section of the subreport, effectively suppressing the output for each record as you see fit.
|
|
|
|
|
Thats what I am looking for.
The question is how do i get to each record?
You havent got some code? (just the object with the periods...)
|
|
|
|
|
Here is a basic idea of how I imagine you are using Crystal Reports.
1) Using Visual Studio (VS) you create a Crystal Report design (.rpt file)
2) Using VS you have your application display the report using the CrystalReportViewer.
My example code is actually from an ASP.Net application, but the idea is the same.
Dim rpt As New ReportDocument
rpt.Load("\myReport1")
'For example purposes, imagine that the myDataSet is populated already
rpt.SetDataSource(myDataSet)
CrystalReportViewer1.ReportSource = rpt
Based on this design, you would put the hide/unhide logic in the Crystal ".RPT" file. You don't have to do anything programatically with VB.
Is this how you are working with Crystal ?
From your examples, I don't think so.
My impression is that the VB.net code should:
1) Create the dataset
2) Invoke the Crystal Report via the CrystalReportViewer and let Crystal do the formatting.
Are we on the same page?
|
|
|
|
|
Hi David,
We are on the same page.
That is basically how mine works too...
Dim rpt As New rptCVForClient()
'Code to hide sections
Try
rpt.SetDataSource(dsCVForClient)
crvReport.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
The problem is I have unbound text boxes in the sections that make the suppressing via property setting not work. I should probably change that, but I have never made a bound label in crystal reports... as er.. weird as that may sound.
|
|
|
|
|
Wow. I think you may have made your life harder by not using bound fields. I would start with working on getting all of your fields on the report to be bound to fields in the dataset. Or you can create formula fields that are based on fields in the dataset.
The report shouldn't be that complicated.
|
|
|
|
|
Hi David, thank you!
The report is working as it should. Thanks for your perserverance and help!
|
|
|
|
|
Good to hear that everything is working now.
I'm sure it is a big relief. On to the next challenge.
|
|
|
|
|
hi all,
i made a user control in VS2008 which works fine in every aspect. But when i import it to VS2008 toolBox and drag drop it to any form... nothing happens... its not added to the form designer... any clue??
thanx in advance for any help!!
|
|
|
|
|
binjafar wrote: any clue
Yes.
Something has gone wrong.
Unfortunately without more information, it is almost impossible to guess what that is.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have this situation
form1 is MdiPArent
Form2 is MdiChild which will be displayed in form1
Form3 is MdiChild which suppose to be displayed in form2
I tried to set form2 IsMdiContainer to True but it did not work.
How I can Display Form3 inside form2, and form2 inside form1?
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Some clues.
A Form is derived from Control .
It is possible to parent controls in a Form .
Think about it!!!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: It is possible to parent controls in a Form.
by using win32 API yes I can.
But before I go for API solution, I try to see if this ability is available in vb native code.
Thanks in advance for any help.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
You do not need Windows API.
................
Dim form3 as New Form3;
form2.Controls.Add(form3)
As I said before a Form instance is really an instance of a Control, and can be treated just like a control, in most instances.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi
You should excuse me. The stupidity bill I take last long more than expected.
for 5 hours and before you post this, I was thinking that you are telling me that what I am asking for is not possible, since Dave also answer that it cannot be done in Mdi.
Just before 10 minute I got what you are asking me to do. You was guiding me to the solution, and I thought something else.
Henry Minute wrote: form2.Controls.Add(form3)
That is totally something new to me.
That did job perfectly.
Thank you very much.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
My pleasure.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Windows does not support having an MdiChild also be an MdiParent.
You're going to have to rethink your design.
|
|
|
|
|
Dave Kreskowiak wrote: Windows does not support having an MdiChild also be an MdiParent
Maybe, but I can do it in VFP, and I don't think vfp is better in vb.net 2008
if vb cannot do it, that is another matter.
Please see this picture below.
http://s701.photobucket.com/albums/ww15/Thecaptin72/?action=view¤t=multiforms.png[^]
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: Maybe, but I can do it in VFP,
VFP does not use MDI and VB.NET and the .NET Framework is not FoxPro.
Samir Ibrahim wrote: if vb cannot do it, that is another matter.
It's not VB that has the problem - it's Windows. I said you cannot use MDI to do what you want.
You CAN however set the TopLevel property of a Form to False and use the form as a control on another form. This is approximately the technique FoxPro uses. It's not true MDI, but it's the closest you're going to get.
|
|
|
|
|
Hi
I'm am using VBA functions in excel to calculate individual cell values. These work fine when the sheet wherein they are contained is active, but sometimes if I navigate to a different sheet and back again all I get is #VALUE in every cell. Interestingly this especially seems to happen when I open another spreadsheet (one on which Spreadsheet 1 depends for a number of values - none of which precede the cells giving the #VALUE errors though). What is probably most annoying is that it happens sometimes and sometimes not and I can't seem to identify why.
Here is a code snippet. This wasn't written by me, but it is relatively simple so I am slightly stumped here:
Public Function GLA(Cat As Integer, Age As Double, Sal As Double, run As Integer, chk As Double)
Application.Volatile
Dim Mult As Double
Dim Flat As Double
Dim MaxGLA As Double
Dim CeaseAge As Double
Dim startRow As Integer
Dim Column As Integer
Dim Retention As Double
exist = Sheets("Parm").Cells(21, 4).Value
If exist = 1 Then
Column = IIf(run = 0, 3, 9)
startRow = 32
Mult = Sheets("Parm").Cells(startRow + 0, Column + Cat).Value
MaxGLA = Sheets("Parm").Cells(startRow + 1, Column + Cat).Value
Flat = Sheets("Parm").Cells(startRow + 2, Column + Cat).Value
CeaseAge = Sheets("Parm").Cells(startRow + 3, Column + Cat).Value
Retention = Sheets("Parm").Cells(startRow + 5, Column + Cat).Value
MaxGLA = IIf(MaxGLA = 0, 100000000, MaxGLA)
If Mult = 99 Then
Mult = Sheets("AgeBands").Cells(Age - 9, Column + Cat).Value
End If
GLA = Mult * Sal + Flat
GLA = IIf(GLA > MaxGLA, MaxGLA, GLA)
GLA = IIf(GLA > Retention, GLA - Retention, 0)
GLA = IIf(Age > CeaseAge, 0, GLA)
End If
End Function
This is then called from each cell as =GLA(...parameters)
Another point: I added the Application.Volatile part because calculations were constantly "lagging behind". I.e. unbeknownst to me the cells in question (and all subsequently dependent cells) were not updating their calculations.
Much appreciated
Karl
|
|
|
|
|