Solved

DBgrid - General task

Posted on 2002-06-03
6
149 Views
Last Modified: 2010-05-02
Hello Experts.
I have a procedure (Proc_1) that is doing tasks on a Dbgrid and Data.
I want this procedure to be a procedure that I can call from different forms in the program.
Therefore, I will have to call the procedure with different Dbgrids and Datas, and the procedure will perform the task.

Public Sub Proc_1(Dbgrid1, Data1)
  Dim The_Db as DBgrid
  Dim The_Data as Data
...
...
...

End Sub

Can anybody help and give me the solution?
Thanks
0
Comment
Question by:HESUS
[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
  • 3
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7051402
Your sub should be in a standard module, and read rather like this (for type security):

Public Sub Proc_1(The_DB as DBGripd, The_Data as Data)

 ...
 ...
 ...

End Sub

Now, I don't see your problem?!
0
 

Author Comment

by:HESUS
ID: 7051577
I did it as follows:

Public Sub Proc_1(The_DB as DBGripd, The_Data as Data)

dim Db1 as DBgrid
dim Data1 as Data

set db1=The_DB
...
...

End Sub

But how do I send The_DB to this procedure?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7051590
First,
Public Sub Proc_1(The_DB as DBGripd, The_Data as Data)

dim Db1 as DBgrid
dim Data1 as Data

set db1=The_DB
...

you don't need to use the SET db1 = THE_db, but you could use the The_DB variable instead.

Now, when you call this proc from your form, you simply call the procedure like this ( i assume that the grid and the data in that form are called MyGrid and MyData ):

Call Proc_1 (MyGrid, MyData)

Cheers
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:HESUS
ID: 7053321
I did what you suggested,and the value of the 'MyGrid' that
the procedure receive is "".And I get an error message about a wrong type.
The value of the 'MyData' that the procedure receive is the MyData.Caption .
Please do not give up.
Thanks
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7053324
Can you send me your project (check my profile for the email address)
CHeers
0
 

Author Comment

by:HESUS
ID: 7054297
Sorry.
Your anwer is 100% correct. I had a mistake.
Many thanks.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Date Picker 64 bit 32 bit issue 12 64
TT Auto Dashboard 13 101
how to Classify of email (pdf attachments) 7 50
Export PDF Form fields to Access  or Excel  in Tab order 16 113
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

733 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