query for items during a certain period

AMER SAID 396 Reputation points
2021-07-05T16:43:14.877+00:00

HI

There is a table showing the types of medicines and the serial for each type of medicine.
There is a column for the quantity received from the item and another for the quantity spent from the item.
There is a column for the date and the last boolean value to delete and hide the element by not setting true

database access 2010 code vb.net .

Table:
MEDICALCOME_TB

column
MEDICALCOME_CODE : Item Code
MEDICALCOME_SERIAL : Company serial
MEDICALCOME_NAME : Item name
MEDICALCOME_COM :Incoming quantity
MEDICALCOME_LEAVE :outgoing quantity
MEDICALCOME_DATE :DATE
MEDICALCOME_CHECK : Checking a boolean value to use by deleting and archiving

I want to sum the period between two dates DateTimePicker - for the total incoming - and outgoing - and the difference between the incoming and outgoing remaining:

Is it possible to inquire within a month? And clarification of the details of the quantities disbursed for four weeks for the same month

I used the following code to search and group between two different date periods. Nothing appears

Blockquote

Dim A = Format(DATETIM_START.Value, "yyyy/dd/MM")

Dim B = Format(DATETIM_END.Value, "yyyy/dd/MM")

Dim DataAdapter As New OleDbDataAdapter("Select MEDICALCOME_TB.MEDICALCOME_CODE, MEDICALCOME_TB.MEDICALCOME_SERIAL, Sum(MEDICALCOME_TB.MEDICALCOME_COM) As SumOfMEDICALCOME_COM, Sum(MEDICALCOME_TB.MEDICALCOME_LEAVE) As SumOfMEDICALCOME_LEAVE
From MEDICALCOME_TB
Where (((MEDICALCOME_TB.MEDICALCOME_CHECK) = True) And ((MEDICALCOME_TB.MEDICALCOME_DATE)between #" & B & "# And #" & A & "#))
Group By MEDICALCOME_TB.MEDICALCOME_CODE, MEDICALCOME_TB.MEDICALCOME_SERIAL ;", con)

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,717 questions
{count} vote

Accepted answer
  1. Xingyu Zhao-MSFT 5,366 Reputation points
    2021-07-07T02:27:42.073+00:00

    Hi @AMER SAID ,
    Change 'yyyy/dd/MM' to 'yyyy/MM/dd':

    Dim A = Format(DATETIM_START.Value, "yyyy/MM/dd")      
    Dim B = Format(DATETIM_END.Value, "yyyy/MM/dd")  
    

    Hope it could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AMER SAID 396 Reputation points
    2021-07-07T21:58:19.577+00:00

    hi

    The query is working now

    How to query the quantities disbursed for each week for four weeks within a month determined by the time tool??

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.