473,657 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TableDef creation, Rich Text Field (Access 2007)

TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I need to create a table, where one of the memo fields shall be a Rich Text field. Can anyone help me with that? This is the code I currently have.

Expand|Select|Wrap|Line Numbers
  1. Public Sub createConTable()
  2. 'Create the table for consequences
  3.  
  4.     Dim tblDef As TableDef
  5.     Set tblDef = CurrentDb.CreateTableDef(strConTable, , , CurrentProject.Connection)
  6.  
  7.     With tblDef
  8.         .Fields.Append .CreateField("KEY_Consequence", dbLong)
  9.         .Fields.Append .CreateField("ID_Hazard", dbLong)
  10.         .Fields.Append .CreateField("int_Number", dbInteger)
  11.         .Fields.Append .CreateField("mem_Consequence", dbMemo)
  12.         .Fields.Append .CreateField("mem_OLD_Consequence", dbMemo)
  13.         .Fields.Append .CreateField("mem_Compare_Consequence", dbMemo)
  14.  
  15.     End With
  16.  
  17.     CurrentDb.TableDefs.Append tblDef
  18.  
  19.  
  20. 'Cleanup
  21.     Set tblDef = Nothing
  22.  
  23. End Sub
I have tried such things as:
Expand|Select|Wrap|Line Numbers
  1. .Fields("mem_Compare_Consequence").Properties("TextFormat")="Rich Text"
without success.

Any help is greatly appreciated.
Jul 2 '10 #1
6 6030
NeoPa
32,568 Recognized Expert Moderator MVP
Is this something you've managed to do manually first Smiley? I have to say that, from my research (2003 only mind you), a Memo field takes plain text data only.
Jul 2 '10 #2
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Access 2007 has built in support for rich text field. A memo field can in that case be either "Plain Text" or "Rich Text". You can manually set the field in design view, but im not one for doing stuff manually :P
Jul 2 '10 #3
NeoPa
32,568 Recognized Expert Moderator MVP
I wouldn't suggest it :D

I was merely asking, as that is often a very good indicator of what is available to do via code.

I'm afraid this seems to be veering into 2007 specific territory, where I drown if I go in too far ;)
Jul 2 '10 #4
ADezii
8,834 Recognized Expert Expert
Try:
Expand|Select|Wrap|Line Numbers
  1. .Fields("mem_Compare_Consequence").Properties("TextFormat")=1
Jul 2 '10 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I found out what to do. The problem is that the property for textformat couldn't be found, unless I had manually created it first (by manually entering table design view and setting it to rich text). Whether this is because Access per default does not create the property, until it is used the first time, or if its because this local table, is generated from a linked access 2000 table in a Access.

Now this is what I did:
Expand|Select|Wrap|Line Numbers
  1. Dim prp as DAO.Property
  2. With myTDF.Fields("mem_Compare_Action")
  3.             Set prp = f.CreateProperty("TextFormat", dbByte, 1) '1=acTextFormatHTMLRichText, constant only known in AC2007
  4.             .Properties.Append prp
  5. End With
Sep 16 '10 #6
NeoPa
32,568 Recognized Expert Moderator MVP
Smiley:
Whether this is because Access per default does not create the property, until it is used the first time, or if its because this local table, is generated from a linked access 2000 table in a Access.
It's the former Smiley. I've come across something similar in the past where it was necessary to create and add the property (I forget which) to the object's collection before it could be accessed, so this is not unique in that respect. I believe it was for Unicode Compression of a text field in a table. I've only ever played in that sort of area once, but I remember it being very hard to work out what was going on and what was required to get past it.

Well done for solving anyway :)
Sep 16 '10 #7

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

Similar topics

3
2586
by: Christoph | last post by:
Does anyone have any recommendations on a good (or, at least decent) and ideally free rich text field control written in javascript? We've been using the one that came with Micro- soft's sharepoint server but we've just been made aware of some licensing issues and are going to need to stop using it. I've been looking around for a replacement but all the ones I've found thus far are not only not free but they have a very (very, very)...
1
7746
by: PC User | last post by:
I found this Rich Text Editor and I've been trying to recreate it in my own application. I've had trouble with the COMCTL.ImageListCtrl and the COMCTL.Toolbar to recreate the toolbar. And I've had trouble with COMCTL.SBarCtrl in recreating the status bar. Does anyone have any experience with these or know of any website that explaines how to use these? http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=5545 ...
5
3882
by: Ira Solomon | last post by:
Hi: Any quick opinions on Access 2007? Has anyone got this to coexist with Access 2003? Thanks Ira
9
8279
by: Neil | last post by:
I need to implement a rich text box in an MDB file for a user base that consists of Access 2000 and Access 2002. Unfortunately, I'm using Access 2003 on my development machine. My understanding is that because of security issues, the Microsoft Rich Textbox Control doesn't work in Access 2003. Thus, I'm left with 3 options: 1) Downgrade my development machine to Access 2002 (if I could even find a copy somewhere). 2) Upgrade all...
2
1781
by: Brad Williams | last post by:
Greetings, I have a Access 2007 App and I want to have a Config File. I have several unbound Text Boxes that are in small Date format that will be used as a Filter for several forms. I would like to: On load get the dates from a config file (Text or other) and on Exit Save to config file. Please help. Thanks,
5
5344
by: ARC | last post by:
Just found out something interesting with Access 2007... In table design, if you set a memo field to the new rich text option, and put that control on a form, set the control to rich text, you can only use the text formatting menus IF the control is on a parent form! If the control is placed on a form that is a subform, the mini format toolbar, and the access toolbar will not work! However, if you place the control on a self-contained...
16
11062
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might know one way or the other whether that was true or not, or could point me to an article or help text that would. What I have seen so far online and in Access 2007 help seems to confirm the above. But that (or at least (b)) seems incredible that it...
2
4398
LBryant
by: LBryant | last post by:
Is there any way, in Access 2003, to offer rich text input without modifying the registry. I'm in a corporate environment where that is not possible. When a RichText control is added to a form, I see this: 'Microsoft Access Dosen't Support this Active X control.' I've tried using the WordPad ActiveX contol which works, but its messy and confusing for the users. Anyone have a solution for rich text in Access 2003 in Windows?
11
12025
by: ARC | last post by:
Hello all, My app has an e-mailing feature where you can e-mail reports, as well as a bulk e-mail feature for e-mailing all customers (as separate e-mails). I allow the user to set the subject text, body text, and browse for attachments. I also allow 3 basic e-mailing options: Default mail handler (Mapi), MS Outlook, and a proprietary e-mailing client. I've always been curious how you would send rich text in the body message, or...
10
5058
by: kujito | last post by:
Ok, here it goes. I got my queries straightened out and they return the data I want in the format I want(finally). The data are sorted alpha. descending by ProjectName. Each project has a unique ProjectID, which is the left-most field. Sorting by ProjectName means that the ProjectID field is not in numerical order. ProjectID 109156 105428 2812 117973 The boss wants to have an ordinal number field called something like 'ItemNumber'...
0
8302
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
8820
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...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
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
4150
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
2726
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
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
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.