Results 1 to 6 of 6

Thread: Passing value from desinger to form

  1. #1

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66

    Passing value from desinger to form

    i'd like to pass the value get from crsytal report designer to main form. Below is my code:
    Code in module
    VB Code:
    1. Option Explicit
    2.  
    3. Public i As Integer
    Code in Designer
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Section4_Format(ByVal pFormattingInfo As Object)
    4.     i = Field7.Value
    5. End Sub
    Code in main form
    VB Code:
    1. Private Sub Form_Load()
    2.     Load form2 'crystal report form
    3.     MsgBox i
    4.     unload form2
    5. End sub
    I get 0 value, which should be 4 (records).
    Anyone has idea what's wrong with my code?
    Thanks!
    "And we know that all things work together for good to them that love God,
    to them who are the called according to his purpose. " --- Romans 8:28

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Are you sure the function Section4_Format is being called?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66
    yeah, you are right. It seems not being called. Do you know how to call it through the main form?
    Thanks!
    "And we know that all things work together for good to them that love God,
    to them who are the called according to his purpose. " --- Romans 8:28

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Is that your full code that you posted?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66
    I tested again. With code below:
    code in main form
    VB Code:
    1. Private Sub Form_Load()
    2.     Load form2 'crystal report form
    3.     'msgbox i ' i comment out this line
    4.     unload form2
    5. End sub
    code in desiger
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Section4_Format(ByVal pFormattingInfo As Object)
    4.     i = Field7.Value
    5.     msgbox i   ' i add this line
    6. End Sub

    I get the value from the report in msgbox. So that means function Section4_Format is being called.
    The problem is how to let this function talk to main form, seems public variable in module doesn't work. Any idea?
    Thanks!
    "And we know that all things work together for good to them that love God,
    to them who are the called according to his purpose. " --- Romans 8:28

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I don't know. Theoretically, it should work.
    My evil laugh has a squeak in it.

    kristopherwilson.com

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