views:

231

answers:

2

Hi, I am new to vb6. I am working to create the invoice generation application. I am using data report to show the generated invoice. The step by step working of process is

Entering the data in to Invoice and ItemsInvoice tables. Then getting the maxId using (Adodc) from the data base to show the last generated Invoice.

Then passing the max Id as parameter to the data report which is showing the invoice according to the invoice id.

It is working fine when I first time generate invoice. Now for 2nd invoice withou closing application I am getting a blank data report. For data report I am using dataenvironment.

I am guessing the reason of blank data report is blank because there was no record for that Id.

But actually the record is inserting in the database.

Please help me.

A: 

I'm not sure how your data set is getting configured, but it sounds like you have a single record in the data and aren't reloading it properly. If your report is manually moving through the recordset and only showing info based on the ID parameter you are passing it and then using the same recordset for the second report, you probably just need to MoveFirst on the recordset to put it back at the beginning.

jasonk
thanks for the replybut I think this is not the problemI am sending you the source code that may help to understand the problemthe code may be split in to more than one post due to the limit of charactersrsInvoice.Recordset.AddNewrsInvoice.Recordset.Fields(1).Value = Val(cmbcustomerId.List(cmbCustName.ListIndex))rsInvoice.Recordset.Fields(2).Value = txtName.TextrsInvoice.Recordset.Fields(3).Value = txtAddress.TextrsInvoice.Recordset.Fields(4).Value = txtCity.TextrsInvoice.Recordset.Fields(5).Value = Val(txtPhone.Text)rsInvoice.Recordset.Fields(6).Value = Date
arvind
rsInvoice.Recordset.UpdatersInvoice.RefreshrsMaxId.Recordset.RequeryrsMaxId.RefreshIf DataEnvironment1.rsInvoice_Grouping.State <> 0 Then DataEnvironment1.rsInvoice_Grouping.Close' here I am getting the last inserted invoice ID that is correct DataEnvironment1.Invoice_Grouping (rsMaxId.Recordset.Fields(0).Value) ' but here not getting the record for the inovice id I am passing The problem may be recordset of DataEnvironment1.rsInvoice_Grouping is not refreshing invoice.Refreshinvoice.Show
arvind
A: 

Load the data environment and refresh the data report. I am also generating report in the similar fashion. I faced this problem. Here's the solution

Load DataEnvironment1 With DataEnvironment1 'Command1 is the command added to data environment where you fire query or 'set it to point to a table

    If .rsCommand1.State <> 0 Then .rsCommand1.Close
    .Command1 maxid         'parameter you pass to the recordset

End With
DataReport1.Refresh
DataReport1.Show

Thats it! You are done. I m sure it will work. Do tell me if it doesnt.

Sangita