Click here to Skip to main content
15,921,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one i need code for change the display control for lookup property in ms access. I know manually but i need this to be do through the c#.net coding. My data is displaying like -1 for true and 0 for false. But i need checkboxes to display true or false. Can you send any one to solve this issue
Posted
Comments
Rajesh Anuhya 17-Mar-11 8:05am    
Your Question is not clear for me.., can you elaborate it more...
janablisslogix 17-Mar-11 8:45am    
just i want to change the ms access column field properties. It has one property named as Display control. In my database the display control is textbox but i need the display control is check box. i can do this job manually in ms access. But i want this through the c#.net code with one function in button click.

and my code is

string Path1 = System.Windows.Forms.Application.StartupPath +"\\CANASIA TOYS & GIFTS PRODUCTS.mdb";
DAO.Field Field = new DAO.Field();
DAO.TableDef tbldef = new DAO.TableDef();
DAO.Property tblpro;
DAO.DBEngine dbeng = new DAO.DBEngine();
DAO.Database db;
db = dbeng.OpenDatabase(Path1, false, false, "");
tbldef = db.TableDefs["PRODUCTS"];
Field = tbldef.Fields["NewRelease"];
tblpro = Field.CreateProperty("DisplayControl", DAO.DataTypeEnum.dbBoolean, false, true);
tbldef.Properties.Append(tblpro);

but it is not working

1 solution

I cannot send anyone to solve this issue but maybe the folowing could help you.

You can change it using a query and use that for the displayed control. You add an expression (in a field) for that column and convert it with that. In the statement below you need to replace column with the actual name of the column that you want to convert.

VB
Expr1: IIf([column] = -1;TRUE;FALSE)


Good luck!
 
Share this answer
 
v2
Comments
Espen Harlinn 17-Mar-11 10:25am    
Nice reply - my 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900