473,811 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create table and set format proprty

Does anybody know of a way to set the format property for a date field
in VBA?? I need to set the property to medium so I can display display
aussie dates on a graph..

Here is what Im doing:

1) Im creating a table on the fly

' Delete the temporary temp if it exists.
On Error GoTo error
db1.Execute "DROP TABLE temp_DS;"

error:
' Create a new temp_CIPII table
db1.Execute "CREATE TABLE temp_DS " _
& " ([Date] DATETIME," _
& " DS_Changes INTEGER," _
& " DS_Defects INTEGER);"

2) now I need to set the format property for the Date,
here is my guesss: Set
CurrentDb().Tab leDefs("temp_DS ").Fields("Date ").Properties(" format") =
"Medium"... . but it does not work

OR does anybody know how to convert american dates to aussie dates
when displaying to a graph...All I need is to display aussie dates on
the graph..HELP!!!
Nov 12 '05 #1
1 9542
You will need to CreateProperty( ) and Append to the field's Properties.

The function below lets you do it in one step, like this:
? SetPropertyDAO( dbEngine(0)(0). TableDefs("MyTa ble").Fields("M yDate"),
"Format", dbText, "Medium Date")

Function SetPropertyDAO( obj As Object, strPropertyName As String, _
intType As Integer, varValue As Variant, Optional strErrMsg As String) As
Boolean
On Error GoTo ErrHandler
'Purpose: Set a property for an object, creating if necessary.
'Arguments: obj = the object whose property should be set.
' strPropertyName = the name of the property to set.
' intType = the type of property (needed for creating)
' varValue = the value to set this property to.
' strErrMsg = string to append any error message to.

If HasProperty(obj , strPropertyName ) Then
obj.Properties( strPropertyName ) = varValue
Else
obj.Properties. Append obj.CreatePrope rty(strProperty Name, intType,
varValue)
End If
SetPropertyDAO = True

ExitHandler:
Exit Function

ErrHandler:
strErrMsg = strErrMsg & obj.Name & "." & strPropertyName & " not set to
" & varValue & ". Error " & Err.Number & " - " & Err.Description & vbCrLf
Resume ExitHandler
End Function

Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant

On Error Resume Next
varDummy = obj.Properties( strPropName)
HasProperty = (Err.Number = 0)
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"mahnovetsk y" <ma*********@ya hoo.com.au> wrote in message
news:e5******** *************** ***@posting.goo gle.com...
Does anybody know of a way to set the format property for a date field
in VBA?? I need to set the property to medium so I can display display
aussie dates on a graph..

Here is what Im doing:

1) Im creating a table on the fly

' Delete the temporary temp if it exists.
On Error GoTo error
db1.Execute "DROP TABLE temp_DS;"

error:
' Create a new temp_CIPII table
db1.Execute "CREATE TABLE temp_DS " _
& " ([Date] DATETIME," _
& " DS_Changes INTEGER," _
& " DS_Defects INTEGER);"

2) now I need to set the format property for the Date,
here is my guesss: Set
CurrentDb().Tab leDefs("temp_DS ").Fields("Date ").Properties(" format") =
"Medium"... . but it does not work

OR does anybody know how to convert american dates to aussie dates
when displaying to a graph...All I need is to display aussie dates on
the graph..HELP!!!

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1872
by: Enver A | last post by:
Hey ppl, I am having trouble in building a smart device application. I cant create a table on SQLCE server using this line. Anyone can tell me what the problem is? I am able to create another 3 Tables same way but this SQL line is always gives me problems. command4.CommandText = "CREATE TABLE MUSTERI (INDEXMS nvarchar(5),MSAD nvarchar(30),MSSOYAD nvarchar(30),MSSEMT nvarchar(30),MSSEMTRCH
1
12781
by: danths | last post by:
Hello, I am being sent a fmt file and a data file without headers which I would like to import into my sql 2000 server. However the data files have couple of 100's of columns, how could I avoid manually creating a table. Can I create a table using a fmt file thru bcp/bulk insert? Thanks sd
236
10090
by: Andrew Rawnsley | last post by:
Anyone out there using beta 2 in production situations? Comments on stability? I am rolling out a project in the next 4 weeks, and really don't want to go though an upgrade soon after its released on an Unsuspecting Client, so I would LIKE to start working with 7.4. -------------------- Andrew Rawnsley President The Ravensfield Digital Resource Group, Ltd.
4
30033
by: Comcast News | last post by:
I have some DDL from DB2/mainframe and it does not list the default value. Example: create table foo ( col1 char(2) not null with default ); Question: So what value does DB2 default in here?
2
13935
by: Alicia | last post by:
Does anyone know why I am getting a "Syntax error in Create Table statement". I am using Microsoft Access SQL View to enter it. Any other problems I may run into? CREATE TABLE weeks ( weekstart datetime not null primary key, weekend datetime not null )
1
1520
by: JohnM | last post by:
Hi, I am trying to roduce a database for teachers to write comments about the work students have done, and both print them on labels and store them. I start with a table containing students names and their classes. I want the software to produce separate tables for each class the teacher teaches. (The reason for this is that dffernet classes will have different need for the marking (sometimes memo fields, sometime numeric.) The...
2
1756
by: Greg McLennan | last post by:
I am writing some Visual basic code that needs to create a M$ Access DB with a table that has a DATE ROW with dd/mm/yyyy in the Format as you would see in the general tab of the table-view. e.g sql = "CREATE TABLE DailyTbale ( DATE(dd/mm/yyyy)" That type of thing. ?? Any Takers ??
1
2268
by: Woof | last post by:
Hi, I'm populating the nodes of a Tree View control via an SQL database, with the lowest child nodes (leaves from now on) Text field being set to a lengthy set of HTML. The outcome is a beautifully formated list of data, where the leaves each show several rows from the SQL database. THE PROBLEM: When I expand each node level manually (clicking the +), the table format of the leaves is spot on, with each column of data formated...
6
3306
by: toadityakumar | last post by:
Create an HTML Page with a text box and button. User can input any values in the text box (for e.g Gunjan, 20, Ankur, 30, Kunal, 40, Rajesh,34 , Naresh,34) the data is seperated by a comma and is entered in a single textbox only. and then user clicks on the button. The values entered in the text box should be displayed in two column's table format. Using javascript and also html
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.