User Profile

Collapse

Profile Sidebar

Collapse
bsm2th
bsm2th
Last Activity: Jan 23 '20, 10:28 PM
Joined: Aug 20 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Just in case people are interested, here is the code at this point, working correctly.

    First, the RecordSource for 'Monthly Report'
    Code:
    SELECT DISTINCT [Households].[zip], [Visits].[visit_month], [Visits].[visit_year] FROM Households INNER JOIN Visits ON [Households].[ID]=[Visits].[Household_ID] WHERE Visits.weekofmonthly>0 And Visits.monthly;
    now the function

    Code:
    Private Sub doreportwithparams()
    ...
    See more | Go to post

    Leave a comment:


  • It worked!! Thanks to everyone who helped me!

    BTW, the fields were numeric. Adding them to the SQL query fixed the problem.
    See more | Go to post

    Leave a comment:


  • Now this is getting clearer.

    From what I understand (not much at the moment), the beginning SQL statement should be set as the RecordSource in the report and sqlWhere should be used in the openreport call.

    What i read on the internet looked like the recordsource and strWhere both came from the openreport call.

    I set the recordsource property in the report and am now getting prompted for month and year...
    See more | Go to post

    Leave a comment:


  • Here is the report I'm trying to make

    Here is the report I'm trying to make...
    See more | Go to post

    Leave a comment:


  • Here is what I have so far.

    Code:
    Private Sub domonthlyreport()
        Dim strReport As String, strQuery As String, strWhere As String
        
        strQuery = "SELECT DISTINCT Households.zip " _
                 & "FROM Households " _
                 & "INNER JOIN Visits " _
                 & "ON Households.ID=Visits.Household_ID " _
    ...
    See more | Go to post

    Leave a comment:


  • It looks odd, but a distinct list of zip codes for the month and year given is what I want at this point.

    I am doing a monthly report for a foodbank I volunteer at. This report is for the state agency that we get most of our food from and this report documents who got food and is used to decide how much we get.

    At this point I need a distinct list of zip codes where people got food. In the report, I break things down...
    See more | Go to post

    Leave a comment:


  • Still having trouble. At the openreport call, not having the strWhere causes a report with all rows of the database. With strWhere causes me to be prompted for month, year, weekofmonthly, and monthly. Then it uses all fields anyway. I verified that strWhere was correct. If it matters, the report only uses the zip field. Also, is there any purpose for the recordset here? openreport seems to be doing all the work(or trying :>)
    Here is my...
    See more | Go to post

    Leave a comment:


  • Good point. Here it is.. I assume that this problem is because the access SQL editor has the sense to correct my SQL, but I don't see how.

    I've looked at the data used, and this is returning rows that don't match the monthly item for this date.

    Code:
        strReport = "Monthly Report"
        strQuery = "SELECT DISTINCT Households.zip " _
                 & "FROM Households, visits
    ...
    See more | Go to post

    Leave a comment:


  • SQL statement gives different results in Access Query and VBA

    I have an SQL statement that after processing becomes (the only processing is to insert the month and year values from a form.)

    Code:
    SELECT DISTINCT Households.zip 
    FROM Households, visits 
    WHERE Households.ID=Visits.household_id 
    AND Visits.visit_month=6 
    AND Visits.visit_year=2019 
    AND Visits.monthly=-1 
    AND Visits.weekofmonthly>0 
    ORDER BY households.zip
    In VBA this returns...
    See more | Go to post
    Last edited by twinnyfo; Jul 10 '19, 12:42 PM. Reason: formatting to make it esaier to read SQL

  • Found the answer elsewhere, it turns out that if there's a negative value returned by mysql, the C api shows it without the sign(the hour variable is unsigned in the C api), and the negative part of the answer is put in a boolean variable called neg attached to the MYSQL_TIME structure. Now I just need to make it work. Neg is always 1, whether the answer should be or not.

    Bob
    See more | Go to post

    Leave a comment:


  • bsm2th
    replied to Calculating between dates
    Doesn't sound like you need many tables. They are a place to put rows of data. This seems to be more like looking a data that is already there and doing some totals. The only table needed would be to hold the monthly totals for past months.

    1> For this item, It sounds like it would be easiest to look at a directory and see how many files are there. I don't know how to so this automatically, but it wouldn't be much trouble to go...
    See more | Go to post

    Leave a comment:


  • I have a TIMEDIFF statement that works in MYSQL, but not in C

    In mysql, this statement gives a negative answer, meaning the start is a later time than the end. This won't work in C, because the hour variable is unsigned. Does anyone know of another way to tell whether or not a time comes before another time..

    Thanks

    Bob

    The statement I used was

    SELECT TIMEDIFF('01:00 :00','02:00:00' );...
    See more | Go to post

  • bsm2th
    replied to TIME DIFFERENCE in SQL
    Not sure what language you're using, but for MYSQL..

    SELECT TIMEDIFF('2005-04-01 03:55:00.000000 ','2005-04-01 00:01:00.000000 ');

    should do it
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...