Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556

    but I'm sure something will still cause me a problem
    More than likely, but there is a huge difference in help found for VBA as opposed to Macros.
    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

  2. #17
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Use converted macros for guidance where you pick up clues that you research, but some of the converted code is what I would call verbal diarrhea. So don't adopt too much of its format or style.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    ScubaBart is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Jul 2024
    Posts
    117
    Quote Originally Posted by Micron View Post
    Use converted macros for guidance where you pick up clues that you research, but some of the converted code is what I would call verbal diarrhea. So don't adopt too much of its format or style.
    Well, That doesn't give me a warm fuzzy feeling.

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    It would be the same if you recorded an Excel macro.

    However it will still work I expect, just do not use the converted code as learning examples entirely.
    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
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Look at it this way.
    If I suddenly decided I wanted to raise bees, and joined a bees forum, there are likely ready made hives that I could buy at a premium, but you would tell me, you don' need this, you don't need that etc.
    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

  6. #21
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Using VBA your requirement is very simple.

    In the load event of the form:

    Code:
    If Me.NewRecord then
         'set your labels for new records
      else
         'set you labels for editing
    end if
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #22
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Well, That doesn't give me a warm fuzzy feeling.
    I think what Micron is referring to is the extra stuff that converting adds to the code that isn't necessarily needed.

    for instance the VBA:

    Code:
    Private Sub Command140_Click()
      DoCmd.OpenForm  "Form1", , , , acEdit
    End Sub
    when converted from a macro :

    Code:
    '------------------------------------------------------------
    ' Command140_Click
    '
    '------------------------------------------------------------
    Private Sub Command140_Click()
    On Error GoTo Command140_Click_Err
    
    
        DoCmd.OpenForm "Form1", acNormal, "", "", acEdit, acNormal
    
    
    
    
    Command140_Click_Exit:
        Exit Sub
    
    
    Command140_Click_Err:
        MsgBox Error$
        Resume Command140_Click_Exit
    
    
    End Sub
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  8. #23
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I have no issue with error handlers such as in that converted code. In fact, if you modify application settings I consider them necessary. For me the converted code isn't great for learning how to concisely name variables or line labels and I suspect it would never set Option Explicit either. Besides, you'll never be able to do many things with vba if all you learn from is converted code, because many things can't be done with those macros in the first place. That last point would be my major one. Or maybe it would be the fact that when a macro bombs out there is no recovering from it (at least there wasn't when I stopped using them long ago).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #24
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    ur a great teacher micron like my french teacher discourage is not the way to support vba has many search result and macro seems not

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

Similar Threads

  1. Issue with label printing
    By SSSlippy in forum Programming
    Replies: 4
    Last Post: 10-04-2021, 08:35 AM
  2. Replies: 13
    Last Post: 09-16-2014, 01:55 PM
  3. Replies: 4
    Last Post: 02-21-2014, 01:29 AM
  4. Manipulating text string
    By genemd in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 05:04 AM
  5. Replies: 1
    Last Post: 03-29-2009, 08:27 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