Hello,
I'm kinda new in VB 6.0. Let me explain the "problem". I work in a company that owns a supermarket chain. The payments for the aquisition of the merchandise is made at the home-office. The bills come at the supermarket locations.The software that records all the bills from the suppliers, installed in all the supermarket locations exports a dbf file wich contains the necesary information for the payments to be done. I want to write a program that enables the user to append the records from the dbf's daily into a global dbf file. Is it possible? Can anyone help me on this with a suggestion, or a link perhaps? 10x a lot
Reply With Quote
Hello,
This is the source code for the app so far. I use Microsoft Visual FoxPro OLE DB provider for the connection to be done.
Now I'm stuck on appending records from the .dbf from the supermarkets into a global dbf. To give a clear ideea of what I worked so far i'll give you the code. I wrote some comments for a clearer picture.
'Author: Nedelea Ionutz
'Company: SC IVET COMPROD SRL
'Project name: Bexport/Import
'Description: Headoffice bills payment solution
'Location: Bucharest, Romania
Private Sub cmdAppend_Click()
'Triggers the common dialog box to fetch a dbf file
With cdlgDBF
.DialogTitle = "Cauta fisier DBF"
.Flags = FileOpenConstants.cdlOFNPathMustExist Or FileOpenConstants.cdlOFNHideReadOnly
.Filter = "Fisiere FoxPro (*.dbf)|*.dbf"
.FileName = ""
.FilterIndex = 1
.ShowOpen
End With
'From now the click event of the cmdAppend button should append the records from the dbf
'I selected with the common dialog box "cdlgDBF" to the adodc1.recordset
'from this point on i'm lost
End Sub
'A command button cmdRaport that triggers a datareport to be shown
Private Sub cmdRaport_Click()
'Bind the datareport textboxes with the values
With DataReport1.Sections("Section1").Controls
.Item("txtPartener").DataField = Adodc1.Recordset("partener").Name
.Item("txtData").DataField = Adodc1.Recordset("data").Name
.Item("txtValCTVA").DataField = Adodc1.Recordset("ctva").Name
End With
Set DataReport1.DataSource = Adodc1.Recordset
DataReport1.Show
End Sub
Private Sub DataGrid1_Click()
'Afisarea inregistrarilor in textbox
With Adodc1.Recordset
txtMagazin.Text = !mag
txtPartener.Text = !partener
txtNrDocFurn.Text = !nrdocfurn
txtValCTVA.Text = !ctva
txtValfTva.Text = !ftva
End With
End Sub
'Data sort ascending/descendig procedure triggered by the click event of the
'column header of the datagrid
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
'Declare the variables
Dim strColName As String
Static bSortAsc As Boolean
Static strPrevCol As String
strColName = DataGrid1.Columns(ColIndex).DataField
If strColName = strPrevCol Then
If bSortAsc Then
Adodc1.Recordset.Sort = strColName & " DESC"
bSortAsc = False
Else
Adodc1.Recordset.Sort = strColName
bSortAsc = True
End If
Else
Adodc1.Recordset.Sort = strColName
bSortAsc = True
End If
strPrevCol = strColName
End Sub
I'm kinda new in VB 6.0. Let me explain the "problem". I work in a company that owns a supermarket chain. The payments for the aquisition of the merchandise is made at the home-office. The bills come at the supermarket locations.The software that records all the bills from the suppliers, installed in all the supermarket locations exports a dbf file wich contains the necesary information for the payments to be done. I want to write a program that enables the user to append the records from the dbf's daily into a global dbf file. Is it possible? Can anyone help me on this with a suggestion, or a link perhaps? 10x a lot
Reply With Quote
Hello,
This is the source code for the app so far. I use Microsoft Visual FoxPro OLE DB provider for the connection to be done.
Now I'm stuck on appending records from the .dbf from the supermarkets into a global dbf. To give a clear ideea of what I worked so far i'll give you the code. I wrote some comments for a clearer picture.
'Author: Nedelea Ionutz
'Company: SC IVET COMPROD SRL
'Project name: Bexport/Import
'Description: Headoffice bills payment solution
'Location: Bucharest, Romania
Private Sub cmdAppend_Click()
'Triggers the common dialog box to fetch a dbf file
With cdlgDBF
.DialogTitle = "Cauta fisier DBF"
.Flags = FileOpenConstants.cdlOFNPathMustExist Or FileOpenConstants.cdlOFNHideReadOnly
.Filter = "Fisiere FoxPro (*.dbf)|*.dbf"
.FileName = ""
.FilterIndex = 1
.ShowOpen
End With
'From now the click event of the cmdAppend button should append the records from the dbf
'I selected with the common dialog box "cdlgDBF" to the adodc1.recordset
'from this point on i'm lost
End Sub
'A command button cmdRaport that triggers a datareport to be shown
Private Sub cmdRaport_Click()
'Bind the datareport textboxes with the values
With DataReport1.Sections("Section1").Controls
.Item("txtPartener").DataField = Adodc1.Recordset("partener").Name
.Item("txtData").DataField = Adodc1.Recordset("data").Name
.Item("txtValCTVA").DataField = Adodc1.Recordset("ctva").Name
End With
Set DataReport1.DataSource = Adodc1.Recordset
DataReport1.Show
End Sub
Private Sub DataGrid1_Click()
'Afisarea inregistrarilor in textbox
With Adodc1.Recordset
txtMagazin.Text = !mag
txtPartener.Text = !partener
txtNrDocFurn.Text = !nrdocfurn
txtValCTVA.Text = !ctva
txtValfTva.Text = !ftva
End With
End Sub
'Data sort ascending/descendig procedure triggered by the click event of the
'column header of the datagrid
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
'Declare the variables
Dim strColName As String
Static bSortAsc As Boolean
Static strPrevCol As String
strColName = DataGrid1.Columns(ColIndex).DataField
If strColName = strPrevCol Then
If bSortAsc Then
Adodc1.Recordset.Sort = strColName & " DESC"
bSortAsc = False
Else
Adodc1.Recordset.Sort = strColName
bSortAsc = True
End If
Else
Adodc1.Recordset.Sort = strColName
bSortAsc = True
End If
strPrevCol = strColName
End Sub