Delete Field in Backend Database

Access 2007 user looking for code that will delete a field from a specified 
table on a backend database.  AND/OR...change the Field Size on an existing 
field.  Thanks!
-- 
DT
0
Utf
5/18/2010 3:32:03 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
826 Views

Similar Articles

[PageSpeed] 45

No user should have this ability.  This is a recipe for disaster!!!!

Anywho,  To delete a field you'd do something along the line of

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
set tdf = db.TableDefs ("YourTableName")
tdf.Fields.Delete ("YourFieldName")

or using SQL, something like

Db.Execute "ALTER TABLE YourTableName " & _
                 "DROP COLUMN YourFieldName;"


As far as resizing a field, check out 
http://www.freevbcode.com/ShowCode.asp?ID=4599 for some inspiration.

But as I stated, this is a very bad idea!!!
-- 
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"DT" wrote:

> Access 2007 user looking for code that will delete a field from a specified 
> table on a backend database.  AND/OR...change the Field Size on an existing 
> field.  Thanks!
> -- 
> DT
0
Utf
5/18/2010 4:04:03 PM
Reply:

Similar Artilces:

The Item could not be deleted. It was either moved or already deleted, or access was denied.
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C42C5B.11C3D7B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I had to rebuild a corrupt database this morning. My Priv.edb and = Pub.edb were the files I worked on with the ESEUTIL. Everything is = working except users are complaining that they cannot delete e-mails = that were "zapped" during the rebuild process. The message they're = receiving is " The Item could not be deleted. It was either moved or = already deleted, or access was denied...

Database Setup
I need to create a database to document employees performance. I need to list the employee, their department and then their job functions that they are responsible for. Each employee in the unit share the same job functions. I need to list about 15 different criteria for each job function and this is where I'm struggling. Would it be best to have a table for each job function and have the criteria part of that table, if I did that I'd end up with about 30 tables. I'm thinking there has to be an easier way, I just don't know what that would be. Any help you can give i...

instructions disppear when users begin type (text field)
Hi all, I need to customize the outlook contact form and I want to add one text field to allow users to add details info and instruct users how to add. Instructions shows in the field and the instructions disappear when users click and begin to type. How should I do this? exchange 2003/outlook2003 Thank you. It's hard for me to visualize exactly what you're expecting to happen. If you want the instructions to stay on the screen, you could display them in a label control. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumps...

Updating Boolean Field with onChange
I am having difficulty with setting a value of a new boolean field using the OnChange scripting against a picklist. If anyone has some sample code / formatting information that I can use it would be greatly appreciated. Also, I also need to know if it is possible to stop the default value for the Revenue (isrevenuesystemcalculated) field on the opportunity form being set to "Yes" when the "Convert Lead" function is used. We can set the default value to "No" for user created Opportunities but when Convert Lead is used it seems to ignore the default value. Again, a...

Delete rows with true or false
Hi, I want to delete all the rows that contain the word true or false. How can I do this? Thanks Diana wrote: > Hi, > > I want to delete all the rows that contain the word true or false. How > can I do this? Can you sort on the column containing true or false, then select all the rows in one group and delete them? Or does it need to be automatic? -- Jordon If the data is in one column, you could apply data|filter|autofilter (in xl2003 menus) to that column. Show the rows that contain either True or False and delete the visible rows. Then remove the au...

When hitting reply to a message, no "Bcc:" header field appears
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange Hi. When I hit &quot;Reply&quot; or &quot;Reply All&quot; to a message in Entourage, the composition window that appears has the usual &quot;To:&quot;, &quot;Cc:&quot;, and &quot;Subject:&quot; form fields near the top, but not one for &quot;Bcc:&quot;. I've looked all over Preferences but don't see an option for this. What am I missing? <br><br>Thanks, <br><br>-c On 2/26/10 11:51 AM, cmetzler@officeforma...

Strange Problem when closing the database object
Hi All, I have a COM component using which is interacting with the database using the CDAODATABASE class. my applications works fine when i built it with VS6. when i built the application with VS2005, the application is suddently unloaded when i am trying to close the database. my database object is CDaoDatabase *m_DB; when my application calls the following method the component is getting unloaded. STDMETHODIMP CFeatureTable::Close() { AFX_MANAGE_STATE(AfxGetStaticModuleState()) HRESULT hRes = S_OK; if (!m_Initialized) return S_OK; TRY_DAO { // Nee...

Windows CE and Databases in VS 2005 #2
I want to create a DB app in windows CE. I do not have experience with t CE. Can you still use .cdb files in Windows CE? Or must one use SQL databases? It seems there's not much documentation for this. Any help appreciated!!! TIA b ...

Fields
I am working in an education template and want to see if there is a way to create a field that can be added to periodically to show all the courses a person takes from my instructors. I created a field named course but it is only allowing me to put one course in. How can I make the field list all the courses? Thanks, Nantika -- Enjoy every day! On Sat, 17 Apr 2010 09:18:01 -0700, Nantika <Nantika@discussions.microsoft.com> wrote: >I am working in an education template and want to see if there is a way to >create a field that can be added to periodically ...

Check Verification data is not saved into the database
A Check tender type has been created with the "Open" Check Verification. It seems to work OK except: 1) Although Driver's License, State and Birth Date are diaplyed on the form in POS the data entered is not saved into the Database. 2) The account Number is masked with X's. Can this be switched off anywhere? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open th...

Default value for custom field?
How can I populate a custom field with a default value? Specifically, I have a custom field "DisplayName" associated with the Quote Detail object. I want initially to populate this field with the value of the product name field when a new product is added to a quote. The user can then edit the DisplayName custom field if desired. The DisplayName custom field will be used as the product name on a Crystal Reports quote form. ...

modify description field in reports
When I print my PO's I can make the part # field in the view report screen wider but when i print it, it defaults back to the regular size. The problem is it cuts off my part numbers on some of my long numbers. Is there a way to overcome this? you must modify the po.xml file directly. "www.choppersapparel.com" <www.choppersapparel.com@discussions.microsoft.com> wrote in message news:8B4E31D5-10A7-4A99-913D-F8F6E3BD7043@microsoft.com... > When I print my PO's I can make the part # field in the view report screen > wider but when i print it, it defaults ...

How do you change a field name in 2002 Excel
I have copied and pasted a whole database from Works into the Excel program but can't seem to find a way to change the field names from A, B, C, to what I want as Last Names, First Names, etc. Aarrrrgh. It can't be THAT difficult! <G> Using the HELP did nothing for me thus I am here asking this silly Q. AnnE in MN You cannot change the Column letters from A, B, C etc. You can choose to have column and row headers not shown under Tools>Options>View Enter your titles(names) in row 1 then select A2 and Window>Freeze Panes to lock row 1 in view. Gord Di...

Multiple indexes on same fields in different order
I sometimes need to find the largest or smallest value in a field. If I put two indexes on the same field, one in ascending order and one in descending order, is Jet smart enough to use the proper index if a give it a grouping query with the condition Max or Min, or am I just wasting resources? Pete -- This e-mail address is fake, to keep spammers and their address harvesters out of my hair. If you want to get in touch personally, I am 'pdanes' and I use yahoo mail. But please use the newsgroup when possible, so that all may benefit from the exchange of ideas. ...

5.5 actual database size
Which formula does exchange 5.5 standard use to decide if it's reached 16G 1. Database size = file size 2. Database size = file size - free space (shown by event 1221) I just need to know if I have to do an offline defrag or not as event 1221 is showing around 4G of free space (after a lot of archiving) but the file size is very close to 16G. Thanks in advance. Pete "=?Utf-8?B?UGV0ZUw=?=" <PeteL@discussions.microsoft.com> wrote in news:367267BB-1251-4F6A-9101-A6751320EB23@microsoft.com: > Which formula does exchange 5.5 standard use to decide if it's reached...

look way to map form at CRM frontend to tables at CRM database
How can I find out what tables which new record has been added on when I enter data through a form in CRM front end? I try to find way to map form in the CRM frontend to the tables at the CRM database at backend? It is CRM 3.0 Thank in advances for help! ...

Unable to delete the Dead Domain controller
Dear, Iam working on windows server 2008 Ent Ed I have two doman controllers in the domain both are GC but only one domain controller has all the fsmo roles but iam having replicattion problems with the dead DC (i.e mppkw-database) and Iam unable to delete or remove the dead domain controller from the domain and iam having follwing problems using the ntdsutil :- matadata cleanup select operation target: list domains Found 1 domain(s) 0 - DC=mediaphoneplus,DC=com select operation target: select domain 0 No current site Domain - DC=mediaphoneplus,DC=com No current server N...

Pivot table field dropdown list reset #2
I would like to know if there is a way to reset a field dropdown list in a pivot table. In some field sometimes I delete data from the source and some items of the field will no longer be there. However, when I refresh the pivot table the dropdown list will still show the old items even if they're not in the source data anymore. I really need your help with this. Thanks a lot in advance for your help, Francisco Molina ...

Select more than 1 object in the lookup field
I would like to have the ability to select more than one object in a lookup field. Is there a way to accomplish this? Thanks No. The only exception to this is the party list (like the to, cc and bcc fields in an email), but this is an internal thing and cannot be used in customizations. -- Michael H�hne, Microsoft Dynamics CRM MVP Web: http://www.stunnware.com/crm2 Feed: http://www.stunnware.com/crm2/atom.aspx Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup ---------------------------------------------------------- "Onetreeup" <Onetreeup@discussions...

Remake deleted account in Windows Live Mail
Hi, is it possible to remae an acount I have removed from Windows Live Mail ? Or just a possibility to import the emails there was in the 2 account I removed ? I did not think the program would delete the emails, when I removed the account settings. Hope someone can help, as there are some emails I would like to save. Best wishes Steen Did you look on the web access for those accounts to see if the emails are still out there? "steendk" <steendk@discussions.microsoft.com> wrote in message news:652B3826-1F5C-4309-99DC-7EE579109C44@microsoft.com......

Reduce database size
My database is getting pretty large and slow. Is it possible to reduce/compress the size of the database or remove old data? Thanks. coupleofdogs wrote: > My database is getting pretty large and slow. Is it possible to > reduce/compress the size of the database or remove old data? You can shrink databases, rebuild index.. and delete old journal entries (digital copy of receipt) .. which is the size of your database ? cod The database is 911 Mb. It shows I have 16 Mb left. Thanks for any help. "coupleofdogs" wrote: > My database is getting pretty large and slow....

How do I keep a formula from changing if a row is added or deleted
I have a formulas referencing cells in another worksheet. When rows are added or deleted from the worksheet the formulas are either changed to skip the new row or receive an #REF! error when a row is deleted. Regardless of what happens in the worksheet I want the formulas to remain the same. Hi see your other post -- Regards Frank Kabel Frankfurt, Germany cwolt wrote: > I have a formulas referencing cells in another worksheet. When rows > are added or deleted from the worksheet the formulas are either > changed to skip the new row or receive an #REF! error when a row is >...

Keep data that is entered in a field until changed
Access 2000, I want to retain a field contents that is entered, until it is changed. Like a default, except that it will only change whenever the user changes the field contents. How do I accomplish that? "lths-kblank" wrote: > Access 2000, I want to retain a field contents that is entered, until it is > changed. Like a default, except that it will only change whenever the user > changes the field contents. How do I accomplish that? If you set a default value for a field, the field will retain that value. If you change the value, the field will save the change. ...

How to delete digits after period
I am working on a price list and want to delete the multiple digit after the period and permanmently on keep two. I know about th increase and decrease decimal. But I need to permanently delete th digits. Can anyone help -- Rogerm ----------------------------------------------------------------------- Rogermb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1673 View this thread: http://www.excelforum.com/showthread.php?threadid=31936 Hi =ROUND(A1,0) -- Regards Frank Kabel Frankfurt, Germany "Rogermb" <Rogermb.1g4s7z@excelforum-nospam.com> sch...

Scheduled Bills/Deposits being deleted by MSN Money!
Money 2k4 Deluxe and Money Central, win xp pro sp-1 tho I doubt this matter.. I have about 2 dozen scheduled bills or deposits set up. When I sync my account with MSN Money, I lose a number of these, they simply aren't listed anymore, although about 10 or so remain. For the life of me, I can't figure out WHY this is happening. For the moment, I'm simply not syncing with MSN money, but that's a less than optimal solution, as it means I have to manually download electronic statements for half a dozen bank accounts. I have before and after screenshots of the bills page, if seeing ...