Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521


    Quote Originally Posted by onlylonely View Post
    No worries, when you have time can help me to take a look on this.
    My point was that while you added the line to set the variable, you took out

    Me.Dirty = False

    so the record is not going to save automatically. In a brief test the code worked when I added that back. I did have to fix the first record, which had a sequence of 0.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Based on your comments, attached is a rough overview of the process(es) involved.

    How much of this will be supported by your database? Violations, Objectives? Containment info? Causes? Evidence?
    Attached Thumbnails Attached Thumbnails CARDiagram.png  

  3. #18
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi Paul,

    Yup, when I removed me.dirty = false it works fine and the unique number show in the column, but the number won’t increment.

    If add me.dirty= false. Column won’t show the unique number. I’m also thinking why sequence number keep on remain 0.

    Quote Originally Posted by pbaldy View Post
    My point was that while you added the line to set the variable, you took out

    Me.Dirty = False

    so the record is not going to save automatically. In a brief test the code worked when I added that back. I did have to fix the first record, which had a sequence of 0.

  4. #19
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi orange,

    All will be supported by the database. All those information will store into the table. But I will split it into 3 tables.

    Quote Originally Posted by orange View Post
    Based on your comments, attached is a rough overview of the process(es) involved.

    How much of this will be supported by your database? Violations, Objectives? Containment info? Causes? Evidence?

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Oh, and the textbox with sequence has to be bound. That's why the sequence field is always 0.

    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Any idea to let the sequence + 1 for bound form?

    Quote Originally Posted by pbaldy View Post
    Oh, and the textbox with sequence has to be bound. That's why the sequence field is always 0.


  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I guess I wasn't clear. The sequence textbox is not bound (has no control source). It needs to be bound to the sequence field:
    Attached Thumbnails Attached Thumbnails 2020-05-13_16-45-40.jpg  
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi Paul,

    Stupid me, i overlooked this and it works fine after i bound it.
    But another problem come , my unique number is ANC2005 + 2 digits sequence. But now i'm getting 1 digit only. ANC20051 instead of ANC200501.
    Any idea?

    Quote Originally Posted by pbaldy View Post
    I guess I wasn't clear. The sequence textbox is not bound (has no control source). It needs to be bound to the sequence field:

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not at my computer. Are you still using the Format() function on the sequence field? That should get you two digits.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi Paul,

    Yes. When form load . i'm using format for sequence.

    Code:
    Private Sub Form_Load()
    
    Dim LValue As String
    Dim A As Date
    
    
    A = Now()
    
    
    MsgBox (A)
    
    
    LValue = Format(A, "YYMM")
    
    
    Forms!F1NCform.txtsequence = Format(Nz(DMax("Sequence", "Query3", "YYMM = '" & LValue & "'"), 0) + 1, "00")
    
    
    Forms!F1NCform.txtscar = "ANC" & LValue & Me.txtsequence
    
    
    'Me.Dirty = False
    
    
    End Sub

    Quote Originally Posted by pbaldy View Post
    I'm not at my computer. Are you still using the Format() function on the sequence field? That should get you two digits.

  11. #26
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    I got it... i just need to change the number to short text in F1 table then will do.

  12. #27
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi onlylonely!

    Take a look in attachment for an unbound form solution (form "F1NCForm").

    I have made some major modifications in "F1NCtbl" and "F1NCForm":

    1. The "fill" controls in "F1NCForm" have the names of the corresponding fields in table "F1NCtbl" for code reduction and flexibility.

    2. The PK of "F1NCtbl" now is the [CAR_ID] (Autonumber), not the SCAR.

    3. Fields [SCAR] and [YYMM] have removed from table "F1NCtbl" and the query "qryF1NC" provides the [SCAR] code plus the [CAR_Y] (the year of [CAR_Date]) and [CAR_M] (the month of [CAR_Date]) instead of [YYMM] for more secured searches.

    For example:
    Code:
    "WHERE [CAR_Y]=" & Year(Date) & " AND [CAR_M]=" Month(Date)
    instead of
    Code:
    "WHERE [YYMM]='" Format(Date;"YYMM") & "'"
    Also, you will find many changes in code of "F1NCForm".

    I hope it helps!
    John
    Attached Files Attached Files

  13. #28
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi John,

    I've solved that issue. Now my issue is bound form cannot bound back to query.

    Appreciate if some1 can help me out.

    1) Click listbox
    2) double click one of the list
    3) then click back

    Not sure why it will not bound to F1.




    Quote Originally Posted by accesstos View Post
    Hi onlylonely!

    Take a look in attachment for an unbound form solution (form "F1NCForm").

    I have made some major modifications in "F1NCtbl" and "F1NCForm":

    1. The "fill" controls in "F1NCForm" have the names of the corresponding fields in table "F1NCtbl" for code reduction and flexibility.

    2. The PK of "F1NCtbl" now is the [CAR_ID] (Autonumber), not the SCAR.

    3. Fields [SCAR] and [YYMM] have removed from table "F1NCtbl" and the query "qryF1NC" provides the [SCAR] code plus the [CAR_Y] (the year of [CAR_Date]) and [CAR_M] (the month of [CAR_Date]) instead of [YYMM] for more secured searches.

    For example:
    Code:
    "WHERE [CAR_Y]=" & Year(Date) & " AND [CAR_M]=" Month(Date)
    instead of
    Code:
    "WHERE [YYMM]='" Format(Date;"YYMM") & "'"
    Also, you will find many changes in code of "F1NCForm".

    I hope it helps!
    John
    Attached Files Attached Files

  14. #29
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not clear on what you're describing, but this line:

    DoCmd.OpenForm "F1NCForm", , , "SCAR = '" & Forms!F2CAPAform!txtscar & "'"

    Is not going to work as expected, opening the form to that record, because the form's Data Entry property is yes. You can override that by adding an argument at the end:

    DoCmd.OpenForm "F1NCForm", , , "SCAR = '" & Forms!F2CAPAform!txtscar & "'", acFormEdit
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #30
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Hi Paul,

    Millions thanks for your advice. Instead of putting acformedit. I've put acformread, as i only need to view back and not edit.
    But another problem comes up. When i put acformread, i'm not able to click the link and direct me to the file. Any idea?


    Quote Originally Posted by pbaldy View Post
    I'm not clear on what you're describing, but this line:

    DoCmd.OpenForm "F1NCForm", , , "SCAR = '" & Forms!F2CAPAform!txtscar & "'"

    Is not going to work as expected, opening the form to that record, because the form's Data Entry property is yes. You can override that by adding an argument at the end:

    DoCmd.OpenForm "F1NCForm", , , "SCAR = '" & Forms!F2CAPAform!txtscar & "'", acFormEdit

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

Similar Threads

  1. Search bar using bound form
    By Aeonem in forum Forms
    Replies: 3
    Last Post: 01-21-2015, 08:23 AM
  2. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  3. Replies: 3
    Last Post: 07-24-2012, 03:11 PM
  4. Bound form with bound combobox
    By Jerry8989 in forum Access
    Replies: 2
    Last Post: 12-05-2011, 01:50 PM
  5. Replies: 0
    Last Post: 05-09-2010, 08:43 AM

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