By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,652 Members | 1,905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,652 IT Pros & Developers. It's quick & easy.

Changing Default Value

P: 23
Hi All,

On my main table(tblCust) I have a field called Status, the default value is set to No. All the accounts currently in the table have a default value No. On my form I have a combo box(cboCust) when an option is selected from the combo box, the account is copied to another table. In the After Update event in the combo box there is an event procedure.
My question is there a way for me to change the default value of that account in the main table from No(0) to Yes(-1) after the transfer is made?
The reason is when I use a query using the main table(tblCust) I can set the criteria for the status to only display yes or No. Hope my explanation is clear. I am new to VB but if someone gives me a reference I am willing to try.
Dec 17 '06 #1
Share this Question
Share on Google+
6 Replies

Expert Mod 15k+
P: 31,487
You won't want to change the default value!
I think you mean change the related value for that record. The default value affects new records only created after it is changed.
If you have the Status field bound on the form then you simply set it to the new value (Yes, True, -1).
It can also be done in SQL if necessary.
Let us know if you need that.
Dec 17 '06 #2

P: 23
Hi NeoPa,

Can you please tell me how this can be done in SQL? thanks for replying.
Dec 17 '06 #3

Expert Mod 15k+
P: 31,487
Hi NeoPa,

Can you please tell me how this can be done in SQL? thanks for replying.
I can but I need some info first.
Which record needs changing?
If identified by unique value (I hope) where do you/I have access to this value?
Dec 17 '06 #4

Expert Mod 15k+
P: 31,487
The basic syntax in SQL is shown below :
UPDATE Statement
Creates an update query that changes values in fields in a specified table based on specified criteria.

UPDATE table
SET newvalue
WHERE criteria;

The UPDATE statement has these parts:

Part Description
table The name of the table containing the data you want to modify.
newvalue An expression that determines the value to be inserted into a particular field in the updated records.
criteria An expression that determines which records will be updated. Only records that satisfy the expression are updated.
As previous post, if you can give me the relevant info I can post the SQL you need for you.
Dec 17 '06 #5

P: 23
Hi NeoPa,

It took me a while but I was able to figure it out. Thanks for helping me out. With you guys helping me out I am definitely getting better at this.
Dec 19 '06 #6

Expert Mod 15k+
P: 31,487
That's the most hoped for result John.
With a little bit of a kick-start people can start to get going themselves.
A lot of our members are actually coming back and posting answers for themselves now.
Dec 19 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.