Solved

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

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now