Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Help Needed

Status
Not open for further replies.

Rasheed Shaik

Programmer
Mar 20, 2011
23
SA
Private rs As New ADODB.connection
Private rr As New ADODB.recordset
Private Sub cmdAcchu_Click()
Set rs = CreateObject("Adodb.connection")
rs.Provider = "Microsoft.jet.oledb.4.0"
rs.Open App.Path & "\Medrar.mdb"
'rs.Open "\\mika\medrar\Medrar.mdb"
Set rr = New ADODB.recordset

rr.Open "select * from Reser where Reno = '" & Combo1.Text & "'", rs, 1, 3

If rr.RecordCount = 0 Then
MsgBox "No record found on query.", vbCritical, "Medrar"

Else
Set Reservation.DataSource = rr
Unload Me
Reservation.Show vbModal
End If

Set rr = Nothing

End Sub





In above code when i run report, it shows only blank report with out data
 
It seems to be working fine for me as long as you are binding your Datafield to something in the recordset you are returning.

Code:
Private rs As New ADODB.connection
Private rr As New ADODB.Recordset

Private Sub cmdAcchu_Click()
    Set rs = CreateObject("Adodb.connection")
    rs.Provider = "Microsoft.jet.oledb.4.0"
    rs.Open "C:\Medrar.mdb"
    Set rr = New ADODB.Recordset
    rr.Open "select * from Reser where Reno = '" & Combo1.Text & "'", rs, 1, 3
    If rr.RecordCount = 0 Then
        MsgBox "No record found on query.", vbCritical, "Medrar"
    Else
        With Reservation
            Set .DataSource = rr
            [highlight].Sections(3).Controls("Text1").DataField = "Reno"[/highlight]
            Unload Me
            .WindowState = vbMaximized
            .Show vbModal
        End With
    End If
    Set rr = Nothing
End Sub

Swi
 
It is working fine for me as long as you are binding your Datafield on the DataReport to something in the recordset. See below for an example.

Code:
Private rs As New ADODB.connection
Private rr As New ADODB.Recordset

Private Sub cmdAcchu_Click()
    Set rs = CreateObject("Adodb.connection")
    rs.Provider = "Microsoft.jet.oledb.4.0"
    rs.Open "C:\Medrar.mdb"
    Set rr = New ADODB.Recordset
    rr.Open "select * from Reser where Reno = '" & Combo1.Text & "'", rs, 1, 3
    If rr.RecordCount = 0 Then
        MsgBox "No record found on query.", vbCritical, "Medrar"
    Else
        With Reservation
            Set .DataSource = rr
            [highlight].Sections(3).Controls("Text1").DataField = "Reno"[/highlight]
            Unload Me
            .WindowState = vbMaximized
            .Show vbModal
        End With
    End If
    Set rr = Nothing
End Sub

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top