Link to home
Start Free TrialLog in
Avatar of aarontham
aarontham

asked on

Save,Edit and Delete database.

Hi,

I use Vb6 Data1 to Data5 control to open foxpro database. after do some sql work then i need to save it into Access 2000 database which i already open with Data6 and Data7.

pls advice how do Save,Edit and Delete database using data control.
ASKER CERTIFIED SOLUTION
Avatar of MYLim
MYLim

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MYLim
MYLim

This code will explain is basically for beginers to master ADODB coding in few minutes. This code will explain how to CONNECT access database, how to generate query, how to traverse the records (that is moveFirst, MoveNext, and so...), how to delete recor ...(description truncated)

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=48747&lngWId=1

Good advice from MYLim
thank's Leon
Avatar of aarontham

ASKER

Hi Guys,

If i use ADODB method would i have problem when i compile the program as i already have the whole program open with Data control. pls advice.

Thank You
 
Youy should get rid of the data control, it will only cause you more greef in the future.
Dear Leonstryker,

Pls help me to get rid of the data control, my code is as below pls advice. what code should it use.



Private Sub Form_Load()
Dim strQuery As String
Dim strQuery1 As String
Dim criteria As String
Dim strQuery2 As String
Dim strQuery3 As String



criteria = ""
strQuery = ""
strQuery1 = ""
criteria = ""
strQuery2 = ""
strQuery3 = ""



Me.WindowState = vbMaximized

 ProgramActivation
  Call SaveActivityToLogDB("Start access Operator menu.")
  Call Message("This menu is for user who has level: 'Operator' and 'Admin' .")
 

cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Quote.mdb;Jet OLEDB:Database Password=mssb18"
cnn.Open

 
   ListView1.ColumnHeaders.Add , , "Capacity", ListView1.width / 4.5
   ListView1.ColumnHeaders.Add , , "Td Part", ListView1.width / 6, lvwColumnCenter
   ListView1.ColumnHeaders.Add , , "Original Part", ListView1.width / 6, lvwColumnCenter

   
     ListView1.View = lvwReport
     
     
 

InitSubClass
Set objLabelEdit = New LabelEdit
objLabelEdit.Init Me, ListView1


'Load data into combo1 (Class)
strQuery = "SELECT DISTINCT descrip1 From pl002 "


Combo1.Clear
Data2.RecordSource = strQuery
Data2.Refresh
If Not Data2.Recordset.EOF Then
Data2.Recordset.MoveFirst

    Do Until Data2.Recordset.EOF
        Combo1.AddItem IIf(IsNull(Data2.Recordset.Fields("DESCRIP1")), "", Data2.Recordset.Fields("DESCRIP1"))
        Data2.Recordset.MoveNext
    Loop
  End If
   
'Load Data Into List1 (Brand)
strQuery1 = "Select * From PL001 "


    criteria = " Where (OEM) Like '" + (Text1.Text) + "*'" ' Create the criteria.


List1.Clear
Data1.RecordSource = strQuery1 & criteria
Data1.Refresh
If Not Data1.Recordset.EOF Then
    Data1.Recordset.MoveFirst
    Do Until Data1.Recordset.EOF
        List1.AddItem Data1.Recordset.Fields("OEM")
        Label2 = Data1.Recordset.Fields("OEMID")
        Data1.Recordset.MoveNext
    Loop
End If


'Load Data Into List2 (Model)

strQuery2 = "SELECT model from pl002 ORDER BY pl002.model"

List2.Clear
Data2.RecordSource = strQuery2 '& criteria2
Data2.Refresh
If Not Data2.Recordset.EOF Then
    Data2.Recordset.MoveFirst
    Do Until Data2.Recordset.EOF
        List2.AddItem Data2.Recordset.Fields("MODEL")
        Data2.Recordset.MoveNext
    Loop

End If


strQuery3 = "SELECT company from cusadd ORDER BY company"
List3.Clear
Data6.RecordSource = strQuery3
Data6.Refresh
If Not Data6.Recordset.EOF Then
    Data6.Recordset.MoveFirst
    Do Until Data6.Recordset.EOF
   List3.AddItem IIf(IsNull(Data6.Recordset.Fields("company")), "", Data6.Recordset.Fields("company"))
        Data6.Recordset.MoveNext
    Loop

End If



End Sub


I plan to run my program in a network with about 5 to 10 user. pls advice the right code.