Solved

DBgrid - General task

Posted on 2002-06-03
6
150 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
Independent Software Vendors: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
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…
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…
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…

695 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