Results 1 to 5 of 5
  1. #1
    nmeuvdast8 is offline Novice
    Windows 11 Access 2021
    Join Date
    Feb 2025
    Posts
    11

    Report showing blank from form

    Hello there. I need your help.

    I have created a meter reading database. In this DB, I have a meter reading form (frmMeterReading) which has the following data:
    ReadingDate
    ReadingID
    SerialaNumber (foreign key)
    Readings

    I have a form for data entry (frmMeterReading) to the tblMeterReading. The ReadingDate is named as ReadingDateText and the serialNumber is named as serialCombo (since this is a combobox). In this form, I wanted the user to enter all data, save, and then print (open report that I have created). The data entry and saving part works ok, its the printing that I am having trouble with, it shows blank. Here is thr code I used for the printing. (Open Report)...

    DoCmd.OpenReport "rptBilling", acViewPreview, , "ReadingDate like'c & Me.ReadingDateText & "*' And serialNumber like ' & Me.serialCombo & "*'"

    I used the same code in another form, frmSearchBilling with the same parameters and it works. I think the problem is that in the frmMeterReading, the control source for the form is tblMeterReading whereas with the frmSearchBilling, the control source is a query I made with a select ststement. The rptBilling control source is a query I made.



    How do I implement this with the current structure of my frmMeterReading with control source as tblMeterReading? Also, currently, I have separate save and print buttons, is it possible to use a single Save/Print button to do these 2 actions? I have tried but Iam having trouble with the Goto Next record new.

    Thabks in advance!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,552
    Dates should be dates, period.
    Should be no need for like in either of the criteria? I would expect just the serial number and perhaps a date range, where I would use between for those.

    Try a query with that criteria and play with that until you get what you want, then use that as the WHERE criteria for the report.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Join Date
    Apr 2017
    Posts
    1,792
    What are you trying to get from 'Me.ReadingDateText & "*' part? Whatever it returns (when ever), it is not a date! So no matching record can exist!

  4. #4
    nmeuvdast8 is offline Novice
    Windows 11 Access 2021
    Join Date
    Feb 2025
    Posts
    11
    Quote Originally Posted by ArviLaanemets View Post
    What are you trying to get from 'Me.ReadingDateText & "*' part? Whatever it returns (when ever), it is not a date! So no matching record can exist!
    What I am trying to get from the Me.ReadingDateText is the date. Its actaully a date field in the form, I just named it ReadingDateText so can I easily reference it in VB code

  5. #5
    Join Date
    Apr 2017
    Posts
    1,792
    Quote Originally Posted by nmeuvdast8 View Post
    What I am trying to get from the Me.ReadingDateText is the date. Its actaully a date field in the form, I just named it ReadingDateText so can I easily reference it in VB code
    Today's date is a number 45740;
    LIKE operator is really meant to compare strings, so I'm not sure what happens when you apply it to numeric value? Maybe in case you get all dates LIKE this one, those must be today's date, or any date>= 457400 - i.e. 25. April of year 3152 or later?!

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

Similar Threads

  1. Replies: 2
    Last Post: 05-11-2020, 06:59 AM
  2. Report Showing Blank Page
    By jo15765 in forum Reports
    Replies: 3
    Last Post: 11-09-2017, 09:36 AM
  3. Replies: 9
    Last Post: 08-08-2016, 02:57 PM
  4. Replies: 2
    Last Post: 04-20-2016, 11:47 AM
  5. Replies: 15
    Last Post: 04-16-2014, 01:15 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