Results 1 to 12 of 12
  1. #1
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167

    Give values to List Box using vba

    Dear friends,


    I have the forms “SKey” and “Key”. The first one (Skey) will be open if you run the Autoexec macro and remain open (on Hidden mode) till you close the database.
    Attached of “SKey” form there are some unbounds fields which they have default values.

    What I need to do:
    1. Using the command button [cmdPID] I want to give value to [cboPID] as new RowSource line taking the value of the similar unbound field on “SKey” form.
    2. After the above procedures I want: If you close the form (“Key” form) and re-open it again the [cboPID] to have as DefaultValue the first Row of its own list (which is the value taken before using the first procedure)

    The Problem:
    Using a very simple vba line code, I can give value to [cboPID] but the problem is when you close this form the [cboPID] field still without default value and is null.
    What I’m trying to do, is to update a list boxes with new rows using a second form. Then after the update of the list it’s important to have default value the updated fields so to solve my problem.

    Thanks in advanced and I will appreciated if anybody can help me. Dear friends,
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    No tables in the db. None of the comboboxes have RowSource. Don't understand what you are trying to accomplish. What is purpose?
    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.

  3. #3
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Trying to create a solution about Security Form with Login features but with embedded code into a form. Yes without tables because if you have tables anybody can take your passwords my friend... Believe me i'm very near to finish the solution and i promise to share it with all forum friend for future purposes...

    Just a little bit more help...

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I still don't understand what you need.

    There is no code for 'login', no passwords, no autoexec macro. What are we supposed to analyze?
    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.

  5. #5
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    The idea:

    In one form (SKey) there are some unbound fields which they have your passwords as Default Values.
    There is a code which can check about that each time when you open the db if your codes are Verified OK.!

    Moreover, there is another form which can Lock the PC Serial Volume Number ON-Open the db. If the SVN is not same with the default value of the unbound [SVN1] the form ask you "if you want to register the PC" because the user has the option to Register 2 PC's. So, if you can follow the instruction regarding the registration of the new PC, we must 'SAVE" somewhere the new SVN..!! We don't want to save the new SVN in a temporary table because anybody can see and change the SVN by his/her own so.....bad lack..!

    So, we must find a solution to save somewhere the new SVN, so each time when the user open the db, automatically the vba code start the "Registration Check Procedures"..! And finally after hundreds of hours searching for solution i found as a good idea the following:

    1. We can put two ListBoxes in one form. The cboSVN1 and cboSVN2. Both are "Null" and working as ListBox without taking data from any tables.. (Anyway we don't have tables..)
    2. When the db open and after the check - in registration procedures, if the SVN is not in your defaultsValues, the db asking you if you want to register the new PC. If so, using a simple procedures we can give this serial number (as a number) to cboSVN1 as a new RowSource.... Till now, everything under control..!! We have it..!!
    3. But, the problem is that, we must find the way this new data given to cboSVN1 to be a DefaultValue so the next time when you close the db and open it again, the data to be there for the registration check-in procedures... THIS IS A PROBLEM... How..!!!!????

    Your hand please...

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Only options:

    1. store value in table

    2. modify the form design to set combobox DefaultValue property

    3. store value in an external text file
    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.

  7. #7
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    June7, give me instraction on how can store the data in external file and of caurse how this external file can be Hidden??

    What you mean
    modify the form design to set combobox DefaultValue property

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Code to write to text file. I don't know how to hide files in Windows Explorer. Set file permissions.
    Bing: VBA read write text file
    http://www.tek-tips.com/faqs.cfm?fid=3767
    http://www.excel-easy.com/vba/exampl...text-file.html

    Code can open an object in DesignView then modify properties and save the object.
    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.

  9. #9
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Ok, lets say i create an external file.... Is it possible to search if the SVN persist into a text file using vba code?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Code can open text file and read each line and look for a string match.
    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.

  11. #11
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Looks like a good solution..! Can you please write an example of this code so to try it?

    Thanks in advanced

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    No, do not want to build for you. Examples should give you enough info. Search for more on web or in forum. Post your attempted code for analysis.
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-02-2014, 06:25 PM
  2. Replies: 11
    Last Post: 11-01-2013, 09:49 AM
  3. sum the values of list box
    By mmahmod in forum Forms
    Replies: 1
    Last Post: 10-29-2012, 11:30 PM
  4. List all values in one cell?
    By Remster in forum Queries
    Replies: 5
    Last Post: 12-17-2010, 04:33 AM
  5. Sum results give me negative values !
    By Costa in forum Reports
    Replies: 4
    Last Post: 03-03-2010, 12:58 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