Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


dynamically populating data report

hey guys! this suppose to be my first post.
im almost done with my project and im stucked in creating a report using data report

here's my code:

public sub cmdOk_click()
On Error Resume Next

Dim name, manager, address, contact, boat, boatname, status As String

Call showEmpInfo
With showEmpRS
'If .State = adStateOpen Then
.Open "SELECT * from showEmployee"

name = !comp_name
address = !comp_add
contact = !comp_cont
manager = !comp_manager
boatname = !emp_on_board
status = !emp_status

boatname = cboBoatName.Text

MsgBox boatname

With reportEmployee

Set .DataSource = showEmpRS
.DataMember = showEmpRS.DataMember

Set reportLabel1 = .Sections("Section4").Controls
Set reportlabel2 = .Sections("Section2").Controls
Set reportField = .Sections.Item("Section1").Controls

reportlabel2("lblCompName").Caption = name
reportlabel2("lblCompAdd").Caption = address
reportlabel2("lblCompCont").Caption = contact
reportlabel2("lblCompOwner").Caption = manager
reportlabel2("lblBoat").Caption = boatname

reportField("txtId").DataField = "emp_id"
reportField("txtEmpName").DataField = "emp_name"
reportField("txtEmpAdd").DataField = "emp_add"
reportField("txtEmpCont").DataField = "emp_cont"
reportField("txtEmpPos").DataField = "emp_position"
reportField("txtEmpPart").DataField = "emp_partida"

End With 'end of 'with' report

End With 'end of 'with' recordset

Exit Sub
End Sub

when i run my project i got this compile error:

Set [color=Blue]reportLabel1 [/color]= .Sections("Section4").Controls

and tells me that "[color=Blue]reportLabel1[/color]" is not defined!

can anybody please help me fix this up?
thanks in advance..

Sign In or Register to comment.