473,402 Members | 2,055 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,402 software developers and data experts.

Changing Data/type in table with Module

I have 14 fields first one is part number and the next 13 are different Product Lines, I need to change the last 13 fields to date/time and leave the first one as a text field. I have to run a make-table query everyday which will switch the fields back to text. I've been switching it to date/time manually but im building a chart with this info and need it to update automatically. Let me know if you can help.

Thanks!
Sep 20 '07 #1
5 1105
bump...........................
Sep 21 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Without a lot more information its difficult to know how to help

However, have a look at the CDate() function.
Oct 3 '07 #3
NeoPa
32,556 Expert Mod 16PB
What's the SQL of your make-table query?
Oct 6 '07 #4
I was able to obtain a soloution to this problem and just thought I would share it with the forum.
Expand|Select|Wrap|Line Numbers
  1. Sub AlterFieldType(TblName As String, FieldName As String, DataType As _
  2.    String, Optional Size As Variant)
  3. Dim cd
  4. If IsMissing(Size) Then
  5. DoCmd.RunSQL "ALTER TABLE [" & TblName & "] ALTER COLUMN [" & FieldName & _
  6.    "] " & DataType
  7. Else
  8. DoCmd.RunSQL "ALTER TABLE [" & TblName & "] ALTER COLUMN [" & FieldName & _
  9.    "] " & DataType & "(" & Size & ")"
  10. End If
  11. End Sub
  12.  
  13.  
  14. Public Function Update_GKNStatus()
  15. DoCmd.SetWarnings False
  16. Screen.MousePointer = 11
  17.  
  18. DoCmd.OpenQuery "qry-getdates"
  19. AlterFieldType "getdates", "status", "date"
  20. AlterFieldType "getdates", "line unit 9997", "date"
  21. AlterFieldType "getdates", "Line Unit 0002", "date"
  22. AlterFieldType "getdates", "line unit 9998", "date"
  23. AlterFieldType "getdates", "Line Unit 0003", "date"
  24. AlterFieldType "getdates", "Line Unit 0004", "date"
  25. AlterFieldType "getdates", "Line Unit 9901", "date"
  26. AlterFieldType "getdates", "Line Unit 0005", "date"
  27. AlterFieldType "getdates", "Line Unit 0006", "date"
  28. AlterFieldType "getdates", "Line Unit 0007", "date"
  29. AlterFieldType "getdates", "Line Unit 0008", "date"
  30. AlterFieldType "getdates", "Line Unit 0009", "date"
  31. AlterFieldType "getdates", "Line Unit 0010", "date"
  32.  
Oct 15 '07 #5
NeoPa
32,556 Expert Mod 16PB
That's a neat solution and thanks for posting it.

Having reread the question, it occurs to me to suggest a method I usually use to avoid the necessity for this.
I typically import the data into an existing table (where every last detail of the design is set up and saved) after first clearing the table using :
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM [Table]
I don't mean to minimise your solution though, it's good and I may well remember it for my own use.
Oct 15 '07 #6

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

Similar topics

9
by: Jon Brunson | last post by:
Is it possible to use a DataAdapter to fill a DataTable, change the DataColumns of that DataTable (and maybe even it's name) and then commit those changes to the database (in my case SQL Server...
1
by: iporter | last post by:
Hi - I am changing a field from type nvarchar to type text, given that I need to store strings longer than 255 characters. To do this I change the data type in SQL Server, then I change the...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
2
by: windandwaves | last post by:
Hi Gurus I have a module with a bunch of functions that tell me everything about a table (e.g. the number of children, whether it exists, the table description, etc..., data-entry quality,...
1
by: Larry Bird | last post by:
I've created a AlertDataClass below within the class I have tables and column that I've create. In the AlertDataAccess class I'm trying to insert data into my tables. AlertDataAccess is a Module...
1
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
3
by: James Mills | last post by:
On Thu, Oct 9, 2008 at 2:26 PM, Warren DeLano <warren@delsci.comwrote: Yes it does :) I second this. It's far better to use Data Structures rather than Programming Constructs
4
by: Mubs | last post by:
Hi ppl, I am trying to insert records into my database using a form. this works. but after this i would like the records to be displayed onto another page.. the database gets updated but the...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.