Quantcast
Channel: VBForums - Reporting
Viewing all articles
Browse latest Browse all 594

Add New Field

$
0
0
Hi

This is the below code . I want to add 1 more field to query . Problem is after adding field in query i want that Database Fields in designer should also update which is not happening.
Code:

Private Sub cmdok_Click()
Set rs = New ADODB.Recordset
str = "select transactionno,vehicleid,prname, custname,tdate,tarewt,taredt,taretime,grosswt,grossdt,grosstime,netwt,tareusercode,transact.type,transact.status,grossshiftdate,tareshiftdate,grossusercode,drivername,tareshiftcode,grossshiftcode from transact,customer,product,users where grossshiftdate=#" & CDate(Format(DTPicker1.Value, "mm/dd/yyyy")) & "# and transact.custid=customer.custid and transact.prcode=product.prcode union select transactionno,vehicleid,prname, custname,tdate,tarewt,taredt,taretime,grosswt,grossdt,grosstime,netwt,tareusercode,transact.type,transact.status,grossshiftdate,tareshiftdate,grossusercode,drivername,tareshiftcode,grossshiftcode from transact,customer,product,users where tareshiftdate=#" & CDate(Format(DTPicker1.Value, "mm/dd/yyyy")) & "# and transact.custid=customer.custid and transact.prcode=product.prcode"
If rs.State = 1 Then rs.Close
rs.Open str, cnn1, adOpenDynamic, adLockOptimistic, adCmdText
Set Report = New Dailyweighing
Report.DiscardSavedData
Report.Database.SetDataSource rs, 3, 1
Report.ParameterFields(1).SetCurrentValue (CDate(DTPicker1.Value))
Report.ParameterFields(2).SetCurrentValue (CheckNull(rsowner!licencedto))
Report.ParameterFields(3).SetCurrentValue (CheckNull(rsowner!laddress) & ", " & CheckNull(rsowner!lcity) & ", " & CheckNull(rsowner!lstate) & "-" & CheckNull(rsowner!lpin))
Report.ParameterFields(4).SetCurrentValue ("Phone.no. " & rsowner!lphone & " Fax. " & rsowner!lfax)

Report.EnableParameterPrompting = False

Me.WindowState = 2
CRViewer1.DisplayGroupTree = False
CRViewer1.Left = 0
CRViewer1.Top = 0
CRViewer1.Width = Me.Width
CRViewer1.Height = Me.Height
CRViewer1.Visible = True
cmdOk.Left = 5000
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

CRViewer1.EnableExportButton = True
End Sub

Thanks

Viewing all articles
Browse latest Browse all 594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>