473,396 Members | 1,785 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,396 software developers and data experts.

How to save multiple datasheet layouts in .mde to a table?

AdamHope
I'm wanting to give my users some options in a datasheet view
* drag the columns around
* set the widths
* show or hide columns, etc.

If they do this, the changes don't 'stick' because they're using an .mde and
the next time they open the system it reverts back to the layout saved when
I created the .mde

I'm trying to add a combo button to select and view the different layouts in my sub form datasheet, and a 'Save Layout' button which records the new and existing control names, widths
and position in a table. Then each time they load the system, the settings
are read from this table for each user,
and the datasheet should look like it did when they saved it or select a different layout from the combo box.

I have some code to set just 1 default to a datasheet, but i would like the information to be stored in a table, to set more than 1 layout for that datasheet.

How do i get the information to be retived and saved to the back end table using VB via a save layout button on the form?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.  
  3. Me.RowHeight = -1
  4.  
  5. With Me.ID
  6. .ColumnHidden = False
  7. .ColumnOrder = 1
  8. .ColumnWidth = -2 'Set for visible text.
  9. End With
  10.  
  11. With Me.FirstName
  12. .ColumnHidden = False
  13. .ColumnOrder = 2
  14. .ColumnWidth = 2880
  15. End With
  16.  
  17. With Me.LastName
  18. .ColumnHidden = False
  19. .ColumnOrder = 4
  20. .ColumnWidth = 2880 
  21. End With
  22.  
  23. 'RunCommand acCmdUnfreezeAllColumns
  24.  
  25. End Sub
  26.  
  27.  
Thanks
Feb 8 '11 #1
3 2145
NeoPa
32,556 Expert Mod 16PB
Nice avatar Adam ;-)

What you are asking is quite involved. Not the sort of code I would expect a beginner to be attempting. With that in mind I don't intend to spoon-feed, but just throw out a few pointers.
  1. Have you considered yet the format of the table that will be used to save the layout?
  2. How will columns and overall formats be handled (IE What will the table structure be? Do you expect a flat structure to cover this?)?
  3. Have you determined how you will identify each user?

These are just some of the questions you need to have answered before you start asking about the details of saving and loading the data (as the answers to these questions will effect how that is done).

I would suggest that a default whatever (depending on your structure) should be stored at the user level. You code would basically check for, and load, the user-based data if found, but would load the default data if no associated user data were found. Saving should be straightforward enough, assuming you have the table structure designed.
Feb 9 '11 #2
Hi Thanks for your quick reply,

I have determined how I will identify each user, by there account number. This will be stored In the layouts table next to there corresponding layouts, The users have a logon and user name which determines what account there are using.

The Datasheet that I want to select different layouts for has about 30 columns in. So I would prefer to save all the information for each column in one field, such as a memo field would be long enough to store all the paramounters.
Such as

txtID,False,1885;txtFirstName,True,2,630;txtLastNa me,True,3,855;txtDOB,True,5,645;txtFavColour,True, 4,1110;

Some how made into - Being “with me.txtID, .ColumnHidden=false, .ColumnWidth=1885 end with; …….ect”

I do not know how I would get this information to save like this in my table for that layout let alone back into the correct format for VB to use, unless I create each paramounter in a separate field for each Hidden, order, width and column heading which would be fairly large for 30 plus columns.

I hope this makes sense!

Thanks
Feb 9 '11 #3
NeoPa
32,556 Expert Mod 16PB
It does make some Adam, but if I can say nicely, not quite enough.

I think you need to give more detailed consideration to how you plan to store this data. I may be able to help here in a general way, but your thoughts don't yet seemed marshalled well enough for me even to be able to guide you directly at this stage. Furthermore, though this may well seem very difficult, I suggest this is something you need to struggle with yourself. It is a very fundamental part of working with databases at the level you seem to be wanting to get to grips with. If it's done for you you will probably not get that understanding that will be so important for you for this and other projects.

At this stage, I would suggest giving a lot of thought (and as with all thoughts that are breaking new ground for you this will probably be difficult/uncomfortable) to exactly how you store this data. This doesn't appear to me to fit a flat file structure well. I would expect a normalised structure would be required (See Database Normalisation and Table structures). It's at about this stage that you come to realise what professional database developers understand, about how important the design and structure are in a database that is anything beyond the very basic, user-level databases. Bolting bits on afterwards doesn't work very well at all in such databases unless the fundamental design allows for it.

Sometimes it's possible to make compromises, but though it may get the db to market quicker, it may leave the db less extensible in case of later requirements. I really think you best next step is to work out exactly what information you need to store, and how best to design the storage of that information. It is neither a trivial task (Sorry about that), nor is getting it right unimportant.
Feb 9 '11 #4

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

Similar topics

0
by: rayone | last post by:
Hi folks. I need advice. 2 options, which do you think is the better option to display/retrieve/report on the data. Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
5
by: deekay | last post by:
I want to allow users to resize and reposition columns of a datasheet but for a prompt to be brought up and only the layout only to be saved if they select "save changes". This is the way it works...
4
by: debi.robarts | last post by:
Ok, in my database I have something like this: Date One # of Days to Next Date These calculate a field "Date Two." Because "Date Two" is an expression (calculated by the form), I can't set...
0
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
The following code geenrated by C# automatically is supposed to save changes on a form with a dataset to the underlying table. For some reason it will not work with Access or SQL. Any ideas why? I...
2
by: ShaijuThomas | last post by:
Hi guys, terribly in need of help. There are multiple gridviews on my web page. I would like the data to be downloaded in a single excel book but with multiple tabs. I don't want client-side scripts....
3
by: bluethunder | last post by:
Good morning guys, I have a problem regarding the usage of the command button in VB 6. I dont know what codes what i will gonna use. How will i gonna call the records from the table using command...
7
by: Birky | last post by:
All, I have scrubbed the archives to see if someone else has requested this type of help but I have not been able to find anything that fits this scenario. I have a form (which is working...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
4
by: edtrvl | last post by:
Hi there, I'm trying to insert multiple rows from a table format web form into multiple rows in a SQL table, (1 row for 1 row). Any help would be greatly appreciated, thanks in advance Here's...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...

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.