Results 1 to 11 of 11
  1. #1
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6

    Access 2007 cannot pass value from coding page to Report page

    Help!!

    I recently migrated my Access 2000 program to Access 2007 using import method. It seems to be everything good except some reports.
    Who can tell me what is the problem? help...

    Coding page value doesn't pass to on Report page, it seems to be ignored from the value of coding page. In Access 2000 works fine but Access 2007 has problem.

    Problem variable name : mx_site, mx_col0...mx_col13. They don't show such value on report.


    Coding page of Report :
    "control" and "arrear_column" is a table both has only one row record.

    Click image for larger version. 

Name:	coding.JPG 
Views:	13 
Size:	66.0 KB 
ID:	16841

    Report page layout:



    Click image for larger version. 

Name:	report layout.JPG 
Views:	13 
Size:	162.1 KB 
ID:	16842

    Preview result of Report page:

    Click image for larger version. 

Name:	preview.JPG 
Views:	13 
Size:	74.7 KB 
ID:	16843

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    What's a coding page? (code in the report?)

  3. #3
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Yes. Code in the report which code behind of report.
    I have been finding the solution for a week, but i cannot figure out where the problem is.

    Please anyone can help for my problem.

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    The variables in question are all public. The quick guess is those variables did not get assigned with value. So, maybe missing procedure/function calls in your report.

  5. #5
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Thank you for your reply ifpm062010.
    but very strange that it runs on Access 2000, it is works fine.
    I Just want to pass some fixed value from control and arrear_column table to report.
    Would you give me more advise about that ?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You need to write more code behind your report. The variables declared in the report's header are initialized during the Report's Open Event. This is good. Now you need to write code to pass the varibles to the various control's on the report.

    This is done by writing code in the appropriate section's Format Event. For instance, if you have a control named "MyTextField1", and this control resides in the "Detail" section of your report, you would create an On Format event handler for the Detail section of the report. Within the Sub Procedure you just created, place code like the following...
    Me.MyTextField1.Value = mx_Col1

    You would repeat this to display each of the 13 variables in your report.
    Me.MyTextField1.Value = mx_Col1
    Me.MyTextField2.Value = mx_Col2
    Me.MyTextField3.Value = mx_Col3
    Me.MyTextField4.Value = mx_Col4
    ...

    Just be sure to identify what section the controls reside in so you create an event handler that will understand the control name you use/desire.

  7. #7
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    If this is all working in Access 2000 and it does not work in Access 2007, 2010, or 2013. That means you probably are missing some code from Access 2000.

    Since you use the import method to migrate the form over. I wonder if if you use upgrade method from Access 2000 to Access 2007, 2010, or 2013 will migrate all the code that did not get migrate over just using import method.

  8. #8
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Thank you so much.

    I don't understand you mean that "Within the Sub Procedure you just created, place code like the following"

    where to add following in my code
    Me.MyTextField1.Value = mx_Col1
    Me.MyTextField2.Value = mx_Col2
    Me.MyTextField3.Value = mx_Col3
    Me.MyTextField4.Value = mx_Col4

    Here is my coding
    Option Compare Database
    Dim dba As Database
    Dim tbla As Recordset
    Public mx_col0, mx_col1, mx_col2, mx_col3, mx_col4, mx_col5, mx_col6, mx_col7, mx_col8, mx_col9
    Public mx_col10, mx_col11, mx_col12, mx_col13
    Public mx_site

    Private Sub Report_Open(Cancel As Integer)
    Set dba = CurrentDb
    Set tbla = dba.OpenRecordset("control")
    mx_site = tbla![Garden Name]
    tbla.Close
    Set dba = CurrentDb
    Set tbla = dba.OpenRecordset("arrear_column")
    If Not tbla.EOF Then
    tbla.MoveFirst
    mx_col0 = tbla![col0_arrear]
    mx_col1 = tbla![col1_arrear]
    mx_col2 = tbla![col2_arrear]
    mx_col3 = tbla![col3_arrear]
    mx_col4 = tbla![col4_arrear]
    mx_col5 = tbla![col5_arrear]
    mx_col6 = tbla![col6_arrear]
    mx_col7 = tbla![col7_arrear]
    mx_col8 = tbla![col8_arrear]
    mx_col9 = tbla![col9_arrear]
    mx_col10 = tbla![col10_arrear]
    mx_col11 = tbla![col11_arrear]
    mx_col12 = tbla![col12_arrear]
    mx_col13 = tbla![col13_arrear]
    End If
    End Sub

  9. #9
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Thank you ifpm062010.
    I pretty sure that I imported all of coding from Access 2000 to Access 2007.
    I will try using upgrade method instead of import method in next morning.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by yuetkui View Post
    ...I don't understand you mean that...
    Then you are going to have a difficult time getting this to work. It is obvious to me and others that there is missing code. This means that you will have to write code. You will need to create code for that which is missing.

    If you can identify the section in your report where the controls reside, you can highlight the section by clicking it. For instance, highlight the details section of your report while in design view. Now you can use the Properties Sheet. Click the Events tab to view the Event Properties. There is an On Format field available within the Property Sheet for your Detail section. Next to the On Format event is an Ellipses (...). If you click the ellipses, you can select the "Code Builder" option to create a new Event Handler/Sub Procedure. Your new code goes between the first and last line that are automatically created by Access.

    Here is a screenshot of clicking the ellipses for a Combobox within a form. Very similar...
    .Click image for larger version. 

Name:	QueryBuilderCombo.jpg 
Views:	7 
Size:	51.9 KB 
ID:	16848

  11. #11
    yuetkui is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Great!! Thank you, ItsMe.
    According to your idea and suggestion, i have been fixed my problem. You are my Superman.

    I also want to say thank you to ifpm062010. thanks for your help.



Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report with page break appears with a blank page, why?
    By clebergyn in forum Programming
    Replies: 4
    Last Post: 02-24-2014, 12:32 PM
  2. Replies: 1
    Last Post: 03-05-2013, 06:38 PM
  3. Replies: 3
    Last Post: 08-07-2011, 09:22 PM
  4. Page break on report inserts empty page between
    By Galadrielle in forum Reports
    Replies: 0
    Last Post: 07-07-2010, 04:18 AM
  5. Replies: 1
    Last Post: 05-22-2010, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums