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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

append from dbf's

Status
Not open for further replies.

johnake

Programmer
Jul 13, 2006
1
CZ
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
 
Well, you show us all the code except the code that doesn't work! Let's focus on your cmdAppend_Click. So far, all it does is show a list of .dbf files in the dialog box. The code you have posted does not "fetch" anything. So, next steps are to capture the selection that the user makes, and plug that selection into your append routine. Where exactly are you having trouble?

HTH

Bob
 
Hi guys,

Im incredibly new to VB... I mean really new.

Heres my issue. I need to write some code into an AfterUpdate Event of a CheckBox that writes Billing Address information into the shipping address fields. Billing addresss are held under customer infomation, shipping address are held seperately in the Orders table. I need to copy to 5 fields (Unit, Street, City, St/Prov, Postal) and actually Write this information to those fields, if the checkbox is selected

Also if the check box is selected, I need those fields locked to prevent further updateing of the company billing address...

And if I change the billing address of the company I'd rather not have that update the Billing address in all previous orders... and I need a straight WRITE function.

Im thinking of using:

Me.ShippingAddress = Me.BillingAddress (for each field)
and
Me.ShippingAddress.Locked = True (or False to unlock)

in an If statement in the AfterUpdate section of the checkbox.

Will this work (I dont know how to code it specifically.. will take further research!!!)

Thanks!
 
Ignore my last mesage... I thought I was posting a new thread!! SORRY. :|
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top