Solved

Microsoft Data Grid Control: Multiple-Step operation generated errors.

Posted on 2003-12-03
3
218 Views
Last Modified: 2013-12-25
A DataGrid Control is boud to a ADO - Recordset. One of the fields is a Textfield and its lenght is limited to 15 characters. This field is also displayed in the datagrid. After typing characters exceeding 15 characters in this coloumn, the data grid control returns the Multiple Step - error. I'am looking for a method or coloumn-property to limitate the characters for a datagrid - coloumn similar to the maxlenght - property of textfields.
0
Comment
Question by:mbreit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 125 total points
ID: 9866664
Put some code in against the KeyPress event for the grid.



The following code will ignore any keys pressed in column 2 when the length of column 2 is 15. It will also beep. It assumes your data grid is called 'DataGridName'


Private Sub DataGridName_KeyPress(KeyAscii As Integer)
  If DataGridName.Col = 1 And Len(DataGridName.Text) > 15 Then
     Beep
     KeyAscii = 0
  End If
End Sub


You can make this dynamic if you refer to the DefinedSize property of the field object which your data grid is bound to.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 15 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question