Give values to List Box using vba

gstylianou

Registered User.
Local time
Today, 12:26
Joined
Dec 16, 2013
Messages
359
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.
 

Attachments

MS Access has tables which are a very nice place to store the sort of values you are talking about I reckon.
 
you may try this:
 

Attachments

First all i would like to thanks all of you for your help.

My friend arnelgp your solution is very helpful. I will try to check it on real database.

Thanks again
 
Guys a little bit more help...

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...
 
(Anyway we don't have tables..)


Like I said earlier tables are a good place to store values. Why don't you have tables? This is MS Access after all, and it's all about tables!
 
Like I said earlier tables are a good place to store values. Why don't you have tables? This is MS Access after all, and it's all about tables!

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..
 
You cannot change the combobox default value unless you open the form in design view which I assume you don't want to do.
 
Encrypt the data and store it in a table
 

Users who are viewing this thread

Back
Top Bottom