Recent content by ysdai

  1. Y

    Solved Form-specific codes in reusable class modules

    Consider this problem solved. I have achieved my original purpose of writing form-specific save codes in a common class module. Should there be any other issues that arise out of this, they are not within the scope of this thread and I should try to deal with them myself. Thanks everybody!
  2. Y

    Solved Form-specific codes in reusable class modules

    You nailed it right there. It WAS an issue that I overlooked because I only had that much time today to test things out. Since I'd always used AfterUpdate instead of BeforeUpdate in the past (a tragic mistake), it didn't come to me that all the save events, even the proper ones like when you...
  3. Y

    Solved Form-specific codes in reusable class modules

    I have modified my code to raise a SaveRecord event for saves and then use the form's BeforeUpdate to trap all the saves. There are quite a few issues. First the codes. This is in the form's code for the SaveRecord event. Public Sub clsNavigate_SaveRecord() 'Form-specific save actions here...
  4. Y

    Solved Form-specific codes in reusable class modules

    Pat: Thanks for taking the time to give me this advice. I really appreciate it. You're absolutely right, I need to get a better grip on existing facts before trying to achieve something new. I jumped into this with just bare-bones knowledge of the long-forgotten BASIC language, not even...
  5. Y

    Solved Form-specific codes in reusable class modules

    Wow, an event declared and raised in the class module, but with the actual code in the parent form. This is completely new to me, but I believe this is the solution I'm looking for. I will implement this and rewrite my code, but it could take quite a while, because my hands are kind of full...
  6. Y

    Solved Form-specific codes in reusable class modules

    Okay, so here's my code. First, variable declarations. I added the Undo and Save buttons. Dim WithEvents mNavForm As Form Dim WithEvents mBtnFirst As CommandButton ... Dim WithEvents mBtnUndo As CommandButton Dim WithEvents mBtnSave As CommandButton Public SaveCancel As Boolean Public...
  7. Y

    Solved Form-specific codes in reusable class modules

    I did that. I put all the save codes into separate public function called SaveRecord, so that hopefully I can not only call it from the Click event of the button but also from the class. Didn't work. This SaveRecord wasn't recognized as the form's member from class level. Hopefully CallByName...
  8. Y

    Solved Form-specific codes in reusable class modules

    Funny I never thought about the BeforeUpdate event, with forms or controls. In fact, I don't think I've ever used it. With controls I always use AfterUpdate for validation, and with forms the dirty bit. I will try this approach. And also CallByName, this one also looks promising. MajP: I would...
  9. Y

    Solved Form-specific codes in reusable class modules

    I've never used the CallByName function, or even heard of it, but it looks like something I can try when I go back to work on Monday. The latest approach I tried was to declare the btnSave_Click of the form, which contains form-specific save actions, as public, and then in the class, whenever a...
  10. Y

    Solved Form-specific codes in reusable class modules

    Using the technique mentioned in this thread: Creating Pseudo Custom Controls with Class Modules, I have successfully created my own set of form-navigation buttons, along with [Save] and [Undo] buttons. However, there is a problem with the [Save] action. Each form has a different save criteria...
  11. Y

    Solved Where Is Syntax Error In My Code - Run-time Error 3075

    I never checked that part. Sorry about that. :(
  12. Y

    Solved Where Is Syntax Error In My Code - Run-time Error 3075

    Then you need to apply the single quotes (') around string data types. I didn't see them in your original code. You can do a Debug.Print or Msgbox the strSQL to double check before execute. I make this kind of careless mistakes very often.
  13. Y

    Solved Where Is Syntax Error In My Code - Run-time Error 3075

    Just a guess, but if CECompany and CACompany are string types, you need to enclose them in single quotes, like this (in red): VALUES('" & Me!CboSelectNewCo.Column(0) & "', '" & Me!CboSelectNewCo.Column(1) & "', "
  14. Y

    Solved Create and delete form on the fly

    I don't save blobs in the database, just the path. But you're right, I should use FollowHyperlink instead. I always thought it was used to open websites only. If this will open the image in the default viewer, that will be the best option. Thanks for the tip.
  15. Y

    Solved Create and delete form on the fly

    I'm actually looking for a way to limit the picture size to screen size. That means, show original size if it fits the screen, otherwise shrink the long side to screen size, but maintain the aspect ratio. Shrinking to screen size doesn't really reduce the picture quality, but zooming definitely...
Top Bottom