A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Alter Table



 
 
Thread Tools Display Modes
  #1  
Old July 10th, 2009, 04:33 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Alter Table

Hi

How do I set the a field default value?

Dim var_empid as Integer
Dim var_sql as String

var_empid = 34
var_sql = "ALTER TABLE Local_gl ALTER COLUMN gl_empid INTEGER DEFAULT " &
var_empid

DoCmd.SetWarnings False
DoCmd.RunSQL var_sql
DoCmd.SetWarnings True

Thank you All!!!

Bre-x


  #2  
Old July 17th, 2009, 07:36 PM posted to microsoft.public.access.gettingstarted
SuzyQ
external usenet poster
 
Posts: 217
Default Alter Table

Not sure how you would do that in code, but you can open the table in design
mode and enter the default value in the properties. Alternatively, you could
set the default value in the form's property under the data tab for the field
in question.

"Bre-x" wrote:

Hi

How do I set the a field default value?

Dim var_empid as Integer
Dim var_sql as String

var_empid = 34
var_sql = "ALTER TABLE Local_gl ALTER COLUMN gl_empid INTEGER DEFAULT " &
var_empid

DoCmd.SetWarnings False
DoCmd.RunSQL var_sql
DoCmd.SetWarnings True

Thank you All!!!

Bre-x



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.