Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    As the article says, if you don't include Option Compare line the Binary option will apply by default and there is rarely a need for Binary comparison and might even cause issues (password validation is the only purpose I can think of where Binary would be preferred). A new module will automatically create with Option Compare Database so leave it alone. I have never changed this.



    Option Explicit requires variables to be declared. This is helpful to discover misspelling of variables. Makes debugging code less frustrating. New modules will include this line if this option is selected in the VBA editor - Tools>Options>Editor>RequireVariableDeclaration
    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.

  2. #17
    Behedwin is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    61

    Question

    Thanks

    I did some cleaning in the code and moved things into modules (worked like this in excel before and like it)
    Hopefully this wont damage things in any way.

    And then i added a "edit" function and some other things.

    Uploaded a new file

    Now ill start working on the "add new profile" button at the top.


    Another problem im facing is how i can add a string of data to a table with a button.

    I want the user to select a row in the log_listbox
    then press a button and on that record row in the log table i want a specific data to be added.

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Could run an UPDATE sql action. What data would be added?

    The 'Add New Profile' button just needs to move to new record row?

    Doubt I would move code into general modules. Unless a procedure will be used by multiple forms, why not have it behind the form using it? Your code is form-specific, not generic, so putting it in a general module just adds complication to the structure.
    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.

  4. #19
    Behedwin is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    61
    Quote Originally Posted by June7 View Post
    Could run an UPDATE sql action. What data would be added?

    The 'Add New Profile' button just needs to move to new record row?

    Doubt I would move code into general modules. Unless a procedure will be used by multiple forms, why not have it behind the form using it? Your code is form-specific, not generic, so putting it in a general module just adds complication to the structure.
    Dont know why i like having them in modules. I have always done it this way.
    It seems to work... but if it is bad for the program to have it like this i could change it. But if it is no matter i rather keep it like this.

    I have worked out how to add new profile

    But could you elaborate more about how to add a value to the selected log row when clicking a button.
    I want the value "KLAR" to be added when a user click on a button. The value should be stored in log_table in the column called "HRWEBB CHECK"
    The value should only be added to the row that the user have selected.

    EDIT

    Reading a bit i found this code....
    Code:
    UPDATE tblCustomers 
        SET Email = 'None' 
        WHERE [Last Name] = 'Smith'
    But im wondering how to specify the selected row in the listbox.
    If i had a field with the Log_id in the profile_form
    maybe i could take that value and specify the WHERE statement?
    Like this

    Code:
    UPDATE tblCustomers 
        SET Email = 'None' 
        WHERE [Log_ID] = txtLog_ID
    txtLog_ID is a textbox displaying the selected Log ID.

    But if this is the way, i dont know how to get the Log_ID into the textbox...

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Can't say it's strictly BAD, just never seen it. Could end up with a lot of modules. Debugging might be a little confusing. But your db is quite small and as long as you are happy and it works ...
    Could be even smaller if you made 1 form serve for the log.


    In some event, perhaps the listbox Click or DblClick event:

    CurrentDb.Execute "UPDATE log_table SET [HRWEBB CHECK]='KLAR' WHERE Log_ID=" & Me.Log_Listbox
    Me.Log_Listbox.Requery
    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.

  6. #21
    Behedwin is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    61

    Thumbs up

    Thanks, that worked perfectly!


    Gotten so much good help here.
    Come quite far very fast.

    Uploading my current file of my project if anyone wants to have a look

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

Similar Threads

  1. Replies: 7
    Last Post: 07-24-2017, 11:47 PM
  2. Replies: 5
    Last Post: 11-26-2013, 11:11 PM
  3. Replies: 5
    Last Post: 08-12-2013, 12:53 AM
  4. Replies: 27
    Last Post: 08-14-2012, 09:05 AM
  5. Replies: 5
    Last Post: 05-14-2012, 02:01 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