Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 44
  1. #16
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800

    I agree that one needs to learn to walk before trying to run but question if the percentage that never uses classes is that high. It would be my preference in some cases, over several TempVars or DLookups. Case in point is a project I developed at work that had but 2 classes - an email object and a user object. User object had several properties (FName, LName, EmplNo, etc.) and any time I wanted to use any of the 7 or so properties in code, they were all in one object.

    The problem I see with the employee class here is that there is no initialize event so the object doesn't get created. Could be why the code won't compile but I don't know.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    Amyfb is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2021
    Posts
    64
    Quote Originally Posted by Micron View Post
    Are you absolutely sure? Look at the OnClick event property setting for your button. It definitely shows [embedded macro].

    Attachment 46083
    okay, here, in this one instance the book has me click the button to then get to the code builder. I now understand how this "embeds" the code but I thought it was all about the Form module where it was contained with other code.

    my head is starting to spin a little here. guess i need to slow down a little.

  3. #18
    Amyfb is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2021
    Posts
    64
    Quote Originally Posted by Micron View Post
    I agree that one needs to learn to walk before trying to run.......
    The problem I see with the employee class here is that there is no initialize event so the object doesn't get created. Could be why the code won't compile but I don't know.
    I've just downloaded the files that go with the book, and am comparing their code with my code , line by line, to see if i can see why their file works and mine does not.
    so far, I found one property without a Let statement on my code (that the book specifically said to omit.....smh) but i don't know if that's everything.

    thanks for the input - you folks are a treasure !

  4. #19
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    I'm ready to toss this book in the trash - it's been a headache from page one. It's as if every other example is missing some little bit.
    Does anyone have a recommendation for a solid workbook?
    What book is it?

    I would classify custom classes as rather advanced. It took me years before many of the concepts finally clicked.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #20
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    the book has me click the button to then get to the code builder
    Did you notice that there were 2 buttons? One is for macros, the other for code. If you set the db option as stated above you should only see the one with the ellipses (...) for code from then on. I think you might have to close and re-open db after setting the property for that setting to take affect.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #21
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    @Micron
    I agree that one needs to learn to walk before trying to run but question if the percentage that never uses classes is that high. It would be my preference in some cases, over several TempVars or DLookups. Case in point is a project I developed at work that had but 2 classes - an email object and a user object. User object had several properties (FName, LName, EmplNo, etc.) and any time I wanted to use any of the 7 or so properties in code, they were all in one object.
    As an alternate to a class object, your User class object could easily have been a simple User Type. That would have allowed you to refer to the fields as .FName, .LName, .EmplNo anywhere in your code. The cat gets skinned again.

  7. #22
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    As well as all the other unnecessary complications that others have mentioned, I also noticed it is based on a UserForm.
    Whilst standard in Excel, these are unnecessary and only rarely used in Access.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #23
    Amyfb is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2021
    Posts
    64
    I want to report back on the results of comparing my code to the digital file supplied as accompaniment to the book.
    1. there was a missing Let statement for one property, and the book instructed to omit it. (thanks author!) I added the statement in.
    2. all the code in the frmModule was in a completely different sequence than how it was in the book. (why author?) I rearranged the code to match.

    AND NOW - it works as expected. But I don't know which of the two fixes I did was the one that worked or if it was a combo of both.

    and, it works without a table, I guess because all we're asking it to do is populate the listbox!

    The book in question is: Access 2019 Programming by Julitta Korol. I also have the Access 2019 Bible by Michael Alexander, but admit I didn't do many of the exercises in that book because - "running" looked like so much more fun than crawling.

    thanks again for all the input folks!

  9. #24
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Order of procedures in module is irrelevant to performance.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #25
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Your book is instructing you to use custom classes. I would estimate that over 98% of Access developers do not ever code custom class modules. It's a very specialized niche, and in my opinion is never required, as the desired result can be accomplished via normal VBA code.
    But Dave, you've got to agree they're fun!
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  11. #26
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by moke123 View Post
    But Dave, you've got to agree they're fun!
    About as much fun as a severe sunburn.

  12. #27
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  13. #28
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Quote Originally Posted by Amyfb View Post
    but admit I didn't do many of the exercises in that book because - "running" looked like so much more fun than crawling.
    And you will soon have the bruises to prove it is not.
    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

  14. #29
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by moke123 View Post
    I would classify custom classes as rather advanced. It took me years before many of the concepts finally clicked.
    Those concepts still hasn't clicked for me ....... (1 of many concepts)

  15. #30
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Quote Originally Posted by davegri View Post
    @Micron


    As an alternate to a class object, your User class object could easily have been a simple User Type. That would have allowed you to refer to the fields as .FName, .LName, .EmplNo anywhere in your code. The cat gets skinned again.
    So that is better? Or is it just different?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Code only works after form is loaded 2nd time
    By joecamel9166 in forum Forms
    Replies: 1
    Last Post: 05-05-2016, 02:12 PM
  2. Replies: 2
    Last Post: 04-09-2015, 03:39 PM
  3. Replies: 4
    Last Post: 11-26-2013, 10:47 AM
  4. Replies: 10
    Last Post: 02-12-2013, 05:04 PM
  5. Replies: 6
    Last Post: 09-02-2012, 04:30 PM

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