473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I change the Field Size property of a linked table using VB?

Hi,

This is my first time using a forum, so here goes...

I have an Access app that is in use by several people who know nothing about PC's. I included a few extra columns in each table to store new data elements as needed (the DB is split, so when I write new reports, I can just ship the front end DB).

Unfortunately, I have now tried to create a new field in a form to use a spare number column and found a problem.... The spare number columns have a field size of 'Long Integer', so when I try to use them to store a decimal - the value gets rounded.

I don't want to have to go to every user, making updates to each back end DB in turn, so:

How can I can the 'Field Size' property of a table in a linked DB, using VB in the front end DB, in such a way that a user could execute it (like putting the VB behind a button, for example)????

Any help is gratefully received.... but I'm new to this Access stuff, so please assume I don't know what I'm doing!

G
Jun 23 '07 #1
1 4451
ADezii
8,834 Expert 8TB
Hi,

This is my first time using a forum, so here goes...

I have an Access app that is in use by several people who know nothing about PC's. I included a few extra columns in each table to store new data elements as needed (the DB is split, so when I write new reports, I can just ship the front end DB).

Unfortunately, I have now tried to create a new field in a form to use a spare number column and found a problem.... The spare number columns have a field size of 'Long Integer', so when I try to use them to store a decimal - the value gets rounded.

I don't want to have to go to every user, making updates to each back end DB in turn, so:

How can I can the 'Field Size' property of a table in a linked DB, using VB in the front end DB, in such a way that a user could execute it (like putting the VB behind a button, for example)????

Any help is gratefully received.... but I'm new to this Access stuff, so please assume I don't know what I'm doing!

G
This one was very tricky since you cannot modify the Properties of a Linked Table Field from within the Current Database. I did, however, solve it and the solution is listed below. I am a little short on explanations because I'm kind of tired right now, but if you need any clarification, let me know and I'll get back to you tomorrow. Good luck.
Expand|Select|Wrap|Line Numbers
  1. Dim strDB As String, MySQL As String
  2.  
  3. Dim appAccess As Access.Application
  4.  
  5. 'Path to External Database
  6. Const strConPathToExtDB = "C:\Test\Testlink.mdb"
  7.  
  8. 'Create new instance of Microsoft Access.
  9. Set appAccess = CreateObject("Access.Application")
  10.  
  11. 'Open database in Microsoft Access window.
  12. appAccess.OpenCurrentDatabase strConPathToExtDB
  13.  
  14. 'tblTopics - Table containing the Field (Long_Integer) to modify
  15. 'after executing the SQL Statement, Long_Integer is now a SINGLE Data Type
  16. MySQL = "ALTER TABLE tblTopics ALTER COLUMN Long_Integer SINGLE;"
  17. appAccess.DoCmd.RunSQL MySQL
  18.  
  19. appAccess.CloseCurrentDatabase
  20. Set appAccess = Nothing
NOTE: Substitute your own Path, Table, and Field Name.
Jun 24 '07 #2

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

Similar topics

2
by: Adam | last post by:
I am importing a table from Informix into Access XP via an ODBC connection. In one of the fields, I will need it to allow 4000 characters. In Access help, it shows the data type can be changed to...
1
by: Old Timer | last post by:
I wish to type in a number in my "Code" field, for instance 1060, I then wish the number 1060 to trigger an event that will fill in the next field (township field) For instance, 1060 brings up and...
2
by: Tor Inge Rislaa | last post by:
How to change row height in a DataGrid I have DataGrid that is filled with data from a table in a DataSet. The content of the cells is text of more than one line (as a note field). What I...
13
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture'...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
6
by: questionit | last post by:
If we have 2 tables, which are linked to each other And i want to change property of a field in one of the tables i.e Max Character Length, etc how would i do it - becasue Ms Access doesn't us...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
5
by: agarwasa2008 | last post by:
Hi, I have a linked table called tbltest and some bounded forms (which add, update, delete records) that were created using that linked table. For some necessary reasons I had to create another...
6
by: gavy7210 | last post by:
hello i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk 1.5.. i have a login form(jsp) in which a user logs in,in case he doesnt enter his username and/or password an error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.