|
the codes below i used to connect to the database and to populate the combobox which is to be called in crystal as aparameter:
Option Explicit Private WithEvents conn1 As ADODB.Connection Private com1 As ADODB.Command Private WithEvents rsUser As ADODB.Recordset Private Sub Form_Load() Set conn1 = New ADODB.Connection Dim sConnect As String Set conn1 = New ADODB.Connection 'CRViewer1.Visible = False
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= C:\MyProg\Data\DB3.mdb;" conn1.CursorLocation = adUseClient conn1.Open sConnect Set com1 = New ADODB.Command Set rsUser = New ADODB.Recordset rsUser.CursorType = adOpenStatic rsUser.LockType = adLockOptimistic rsUser.Source = "Select UserID From Users Where IsOfficer = YES" Set rsUser.ActiveConnection = conn1 rsUser.Open Showusers End Sub
Public Function Showusers() As String Combo1.Clear rsUser.Requery rsUser.MoveFirst Do Until rsUser.EOF Combo1.AddItem rsUser!UserID rsUser.MoveNext Loop End Function
the codes below is used to create the UFL
Option Explicit Public Function showuser() As String Dim x As Long x = Shell(App.Path & "\crUFLfrm1.exe", vbNormalFocus) End Function
Private Sub Class_Initialize() showuser End Sub
i already added the crUFLcbo to crystal the probem is everytime i start crystal the combo box appears. it shouldnt behave that way. it should be displayed only if i run the premiums report as a parameter. once the user clicks one value in the combo box it calls the data in the database and returns all the member under the selected user. help anyone, i dont know how to call it in crystal properly.
|