Report Custom Code / References

Trying to use the custom code of the report used by VB.NET

Page 1 of 1

5 Replies - 2629 Views - Last Post: 17 October 2008 - 07:17 AM Rate Topic: -----

#1 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Report Custom Code / References

Posted 16 October 2008 - 11:28 AM

	 Public Function GetStartDate() As Date
		Dim dStart As String
		dStart = frmStart.dtpStartDate.Value.Month.ToString & "/" & frmStart.dtpStartDate.Value.Day.ToString & "/" & _
				 frmStart.dtpStartDate.Value.Year.ToString
		Return dStart
	End Function
	Public Function GetEndDate() As Date
		Dim dEnd As String
		dEnd = frmStart.dtpEndDate.Value.Month.ToString & "/" & frmStart.dtpEndDate.Value.Day.ToString & "/" & _
			   frmStart.dtpEndDate.Value.Year.ToString
		Return dEnd
	End Function



Okay that's my code. Now what I'm trying to do is put that in the Custom Code area of the report that you can use from VB.NET.

Whenever I put that in there it says that frmStart is not declared. I can't declare it as a new frmStart or it will initialize the frmStart and throw the whole freaking program out of whack. I had to learn that the hard way with the classes I had done that with.

And I can't just declare it as the frmStart because then it'll ask to have the word new in front which will again cause the same problem I explained in the paragraph above this.

Throughout the program that I'm writing I've been able to put frmStart.whatever and it would just find it from the form. I didn't have to declare it.

So then I tried put a reference to it in the Report Properties....

That was a total bust and I'm at my wits end. I tried to ask my husband for help and he freaking snapped at me because he doesn't know how and no one here else does either...

Please help!!!

:blink: :crazy: :angry: :cry2: :wacko:

Is This A Good Question/Topic? 0
  • +

Replies To: Report Custom Code / References

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1633
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Report Custom Code / References

Posted 16 October 2008 - 11:35 AM

Why dont you try this

Public Function GetStartDate(ByRef frm As Form) As Date
        Dim dStart As String
        dStart = frm.dtpStartDate.Value.Month.ToString & "/" & frm.dtpStartDate.Value.Day.ToString & "/" & _
                 frm.dtpStartDate.Value.Year.ToString
        Return dStart
End Function

Public Function GetEndDate(ByRef frm As Form) As Date
        Dim dEnd As String
        dEnd = frm.dtpEndDate.Value.Month.ToString & "/" & frm.dtpEndDate.Value.Day.ToString & "/" & _
               frm.dtpEndDate.Value.Year.ToString
        Return dEnd
End Function



Then when you call it pass frmStart to it
Was This Post Helpful? 0
  • +
  • -

#3 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: Report Custom Code / References

Posted 16 October 2008 - 11:47 AM

... :wacko:

Wait how would I pass it?

--------------------------------------------------------------------------------------------------------------------------

OMG! How could I be so freaking stupid. I got what you're saying...

Lol. Sorry about that. I swear I'm not blonde. My natural hair color is red.

--------------------------------------------------------------------------------------------------------------------------

Alright...

I missing something here I know it!!!

=Code.GetStartDate(frmStart)


That's what's in the text box to call the Code. It's still saying that frmStart is not declared. The only thing that's changed is where it's said it's not declared at.

Damnit!!!

:cry2: I need help so bad.

--------------------------------------------------------------------------------------------------------------------------

I've even added the form as a data source and it still says that it's not freaking declared and it's not accepting the frm as Form thing either.

...

*screams*

This post has been edited by MacAnimeGirl: 16 October 2008 - 11:51 AM

Was This Post Helpful? 0
  • +
  • -

#4 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: Report Custom Code / References

Posted 16 October 2008 - 01:31 PM

Please someone help me!
Was This Post Helpful? 0
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,352
  • Joined: 29-May 08

Re: Report Custom Code / References

Posted 16 October 2008 - 02:09 PM

Quote

=Code.GetStartDate(frmStart)



*screams*


Is this part in the form named : frmStart?
Was This Post Helpful? 0
  • +
  • -

#6 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: Report Custom Code / References

Posted 17 October 2008 - 07:17 AM

No, it's in the report. To get to the custom Code you have to do Code. and then whatever procedure you want to call.

I was trying to pass the frmStart in. It's not working.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1