Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59
    nice story seems realistic, but i guess many readers need examples from what u telling


    btw i have new problem my pc crashed and using my friends pc , i open my last form and got ## in my date fields except in the imported table
    seems that excel import create different table structure then vba .
    so na my import is dd/mm.. and my new tables created from import are mm/dd...
    thats probably reason why filter not work on imported table

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    open my last form and got ## in my date fields
    Like this you mean ?
    Attached Thumbnails Attached Thumbnails Columns.JPG  
    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. #18
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59

    more confusing those date routine

    Quote Originally Posted by Welshgasman View Post
    Like this you mean ?
    yes

    but 1st time it was mm/dd na its dd/mm but not 24hours thats why ###

    im still thinking what format has to do with compare date , compare date as string is not logic because often counting in the dates
    btw i just debug.print filter without problems. seems changing pc needs more time for sync without warning/mention it.
    expected those are in datebase not in access, because share with more people.

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    That # is just because the column is not wide enough to show the value?
    That happens to ANY column that is not large enough to show the value, nothing to do with dates.
    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

  5. #20
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59
    tnx i know that but the size was already set correct, just the other pc changed from HH to hh ( 24/am-pm)
    just finding a way to keep my events and change back to HH

  6. #21
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    i just debug.print filter without problems.
    And could you show us what it resolved to?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #22
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59

    debug.print filter

    Quote Originally Posted by moke123 View Post
    And could you show us what it resolved to?
    few debugs:
    Debug.Print "v5:", v5, Forms!form1.rates_subform.Form.filter
    Debug.Print v6, v5, Forms!form1.advance_subform.Form.filter 'between


    Debug.Print "v4:", v4, Forms!form1.rates_subform.Form.dt.Value, Format(Forms!form1.rates_subform.Form.dt.Value, "yyyy/mm/dd HH:mm:ss")
    Forms!form1.rates_subform.Form.filter = "(format([dt],'yyyy/mm/dd HH:00:00') = format(#" & v4 & "#,'yyyy/mm/dd HH:00:00'))"
    Forms!form1.rates_subform.Form.FilterOn = True
    Debug.Print "dt:", Forms!form1.rates_subform.Form.dt.Value, ";", Forms!form1.rates_subform.Form.filter
    i never had am/pm in my spreadsheets / databases just now on other pc dd/mm am/pm (its an recent insider preview version) most look quite nice just the am/pm bothers me. and need to find out why sometimes only time no date
    v4: 16/12/2023 8:00:00 am 01/01/2024 8:00:00 am 2024/01/01 08:00:00
    dt: 16/12/2023 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    v5: 16/12/2023 8:00:00 am (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    01/12/2023 8:00:00 am 16/12/2023 8:00:00 am (format([datum],'yyyy/mm/dd HH:mm:ss') between format(#01/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss') and format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss'))
    v4: 16/12/2023 8:00:00 am 16/12/2023 8:00:00 am 2023/12/16 08:00:00
    dt: 16/12/2023 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    v5: 16/12/2023 8:00:00 am dt = null
    01/12/2023 8:00:00 am 16/12/2023 8:00:00 am (format([datum],'yyyy/mm/dd HH:mm:ss') between format(#01/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss') and format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss'))
    v5: 16/12/2023 8:00:00 am dt = null
    01/12/2023 8:00:00 am 16/12/2023 8:00:00 am (format([datum],'yyyy/mm/dd HH:mm:ss') between format(#01/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss') and format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss'))
    v4: 16/12/2023 8:00:00 am 16/12/2023 8:00:00 am 2023/12/16 08:00:00
    dt: 16/12/2023 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    v4: 16/12/2023 8:00:00 am 01/01/2024 8:00:00 am 2024/01/01 08:00:00
    dt: 16/12/2023 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    v5: 16/12/2023 8:00:00 am (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    01/12/2023 8:00:00 am 16/12/2023 8:00:00 am (format([datum],'yyyy/mm/dd HH:mm:ss') between format(#01/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss') and format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:mm:ss'))
    v4: 16/12/2023 8:00:00 am 16/12/2023 8:00:00 am 2023/12/16 08:00:00
    dt: 16/12/2023 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#16/12/2023 8:00:00 am#,'yyyy/mm/dd HH:00:00'))
    v4: 31/12/2023 01/01/2024 8:00:00 am 2024/01/01 08:00:00
    dt: 04/01/2024 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#31/12/2023#,'yyyy/mm/dd HH:00:00'))
    v4: 31/12/2023 01/01/2024 8:00:00 am 2024/01/01 08:00:00
    dt: 04/01/2024 8:00:00 am ; (format([dt],'yyyy/mm/dd HH:00:00') = format(#31/12/2023#,'yyyy/mm/dd HH:00:00'))
    v5: 04/01/2024 8:00:00 am (format([dt],'yyyy/mm/dd HH:00:00') = format(#31/12/2023#,'yyyy/mm/dd HH:00:00'))
    12:00:00 am 04/01/2024 8:00:00 am (format([datum],'yyyy/mm/dd HH:mm:ss') between format(#12:00:00 am#,'yyyy/mm/dd HH:mm:ss') and format(#04/01/2024 8:00:00 am#,'yyyy/mm/dd HH:mm:ss'))
    on ur request

  8. #23
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Looks like you have delimiters wrong.

    A filter for a form should look something like

    strFilter = "Datum = " & format(somefield, JetDte)

    or

    strFilter = "Datum between " & format(somefield, JetDte) & " and " & format(anotherfield, JetDte)
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  9. #24
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59
    me.strfilter="inventory_date=#12/13/1999#" to avoid dd/mm problems, dateparts if still have problems
    me.strfilter="invenrory_date=#" & format('13/12/1999','mm/dd/yyyy') & "#"
    me.strfilter="inventory_date=#" & format(rst.fields(0),'mm/dd/yyyy') & "#"
    or
    me.strfilter="inventory_date=" & format(rst.fields(0),'\#mm\/dd\/yyyy\#')

    the problem understanding is what jetdte and somefield are defined (jetdte as string, somefield as date)
    so if rst.fields(0) not a date field then it need between # to

  10. #25
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Holy post explosion Batman!!!

  11. #26
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59
    Quote Originally Posted by ano View Post
    vba seems only to understand USA standard even all other MS support non USA standard
    dim a,b as date
    a=#21/12/1999#
    -->
    a = #12/21/1999#
    b=#1/3/1999#
    -->
    b = #1/3/1999#
    seems its already known many years
    but i not really found solution for this
    no zip file u need to type in vba ur self to see it happen
    solving the problem with date creating records with vba dont use vba but use (no twisting dd/mm any more)
    p1 = rs.Fields(i + 1).Name 'nick name
    p2 = rs.Fields(i).Name 'field name, the earn
    st = "INSERT INTO EARN SELECT Sheet1.[Field1] AS dt,'" & p1 & "' AS md, Sheet1.[" & p2 & "] AS mn FROM sheet1 WHERE nz(sheet1.[" & p2 & "],0) > 0;"
    db.Execute st
    this has no format problem

  12. #27
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Only b is a date type.
    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

  13. #28
    ano is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    59

    sql instead vba solve easy date twisting problems

    Quote Originally Posted by Welshgasman View Post
    Only b is a date type.
    yeah but twisting dd/mm is very disturbing and format is not the easiest way to solve.
    as u can see sql is not complex
    tnx for all support

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Handeling multiple languages
    By sisva18 in forum Programming
    Replies: 3
    Last Post: 08-26-2021, 12:53 PM
  2. Handeling If null
    By Homegrownandy in forum Queries
    Replies: 14
    Last Post: 01-10-2017, 09:43 AM
  3. Query handeling empty FK keys
    By warlock916 in forum Access
    Replies: 1
    Last Post: 01-12-2016, 07:18 AM
  4. This might be confusing
    By djclntn in forum Queries
    Replies: 7
    Last Post: 12-08-2011, 10:56 PM
  5. Handeling Multipule Units of Measure
    By Waldenbound in forum Database Design
    Replies: 1
    Last Post: 09-02-2011, 08:24 AM

Tags for this Thread

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