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
Solved

using a form as parameter

Posted on 2003-10-31
3
138 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
3 Comments
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 125 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…

839 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