Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using a form as parameter

Posted on 2003-10-31
3
Medium Priority
?
144 Views
Last Modified: 2010-05-01
I have  several "identical" forms which I try to alter dynamicaly. I tried the following but this doesn't work. It has something to do with the Frm1 as Form but I don't know what

alterq(FrmCust1,1)


private sub AlterQ(Frm1 As Form, Soort As Byte)
Dim x As Byte

Set rsRndVragen = New ADODB.Recordset

rsRndVragen.Open "select * from rndQ where Custid = " & CustID & " and soort = " & Soort, CN, adOpenStatic, adLockReadOnly
rsRndVragen.MoveFirst

With Frm1
    x = 0
    Do While Not rsVragen.EOF
        .Controls("lblvraag1" & "(" & CStr(x) & ")").Caption = rsVragen!vraagtext
        .Controls("Option1" & CStr(x)).Item(0).Caption = rsVragen!antwoord1
        .Controls("Option1" & CStr(x)).Item(1).Caption = rsVragen!antwoord2
        .Controls("Option1" & CStr(x)).Item(2).Caption = rsVragen!antwoord3
        x = x + 1
        rsVragen.MoveNext
    Loop

    rsRndVragen.Close
End With

Set rsRndVragen = Nothing

End sub
0
Comment
Question by:RonaldBiemans
[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 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 9657109
Make sure the object/ variable in this sub is defined as Public, like:

private sub AlterQ(Frm1 As Form, Soort As Byte)

to

public sub AlterQ(Frm1 As Form, Soort As Byte)
0
 
LVL 1

Expert Comment

by:JonGartzia
ID: 9657871
Try this:

private sub AlterQ(Frm1 As Object, Soort As Byte)
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9658034
I have just tried this using Option buttons as controls & dropping the db connection. It works. Can you say what does happen in your case?
With Frm1
    x = 0
    'Do While Not rsVragen.EOF
        '.Controls("lblvraag1" & "(" & CStr(x) & ")").Caption = rsVragen!vraagtext
        .Controls("Option1" & CStr(x)).Caption = "rsVragen!antwoord1"
        .Controls("Option2" & CStr(x)).Caption = "rsVragen!antwoord2"
        .Controls("Option3" & CStr(x)).Caption = "rsVragen!antwoord3"
        'x = x + 1
        'rsVragen.MoveNext
    'Loop

    'rsRndVragen.Close
End With
0

Featured Post

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!

Question has a verified solution.

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

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Suggested Courses

604 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