Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I am using DBGRID for entering data in unbound mode. How do I restrict user to a certain number of rows?

0
Posted

I am using DBGRID for entering data in unbound mode. How do I restrict user to a certain number of rows?

0

You need to keep truck of number of rows and compare it with row limit you set. Something like this Private Sub DBGrid1_UnboundAddData(ByVal RowBuf As MSDBGrid.RowBuffer, NewRowBookmark As Variant) iRows = iRows + 1 If iRows > iLimit Then DBGrid1.AllowAddNew = False End Sub Private Sub DBGrid1_UnboundDeleteRow(Bookmark As Variant) iRows = iRows – 1 If iRows < iLimit Then DBGrid1.AllowAddNew = True End Sub Where iRows - variable that keeps current number of rows and iLimit - variable that keeps maximum number of rows allowed I'm developing reports in VB6 using Data Report and have problems changing the printer setup on the user's machine (he doesn't have permissions to change the page setup properties of the printer) Since he can't change the default from Portrait to Landscape the report won't run - because of "paper size" error. I want to change the properties of the printer just for the duration of the program (like Word does) but can't. I even tried changing it via API - no access to

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123