Solved

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

Posted on 2003-12-03
3
215 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

713 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