DATA CONTROL AND
VISUAL DATA
MANAGER

MELJUN CORTES
Using Visual Data Manager
 


Launch Visual Data Manager from the VB Add-Ins menu.

 


Choose File/New..., choose Acces...










In Visual Data Manager, choose File/Open
Database, and open a database file, such as
the one you created a ...
Data Controls Event




 


The Error event handles any error that occurs with the
database. Use this event to code wha...
RecordSource and RecordSet
Properties


The RecordSource tells where the data will
come from. You can think of the Record...
RecordSet Methods








Data1.RecordSet.AddNew
Data1.RecordSet.Delete
Data1.RecordSet.MoveNext
Data1.RecordSet.Mo...
RecordSet Properties










Data1.RecordSet.EOF -True if MoveNext has moved us past the
last record
Data1.RecordSe...
Other Codes For Data Control




Syntax : Data1.DatabaseName = App.Path &
“
databaseName.mdb” – Using this code you
may ...
Upcoming SlideShare
Loading in …5
×

MELJUN CORTES Visual Basic 6 Data Control and Visual Data Manager

893 views

Published on

MELJUN CORTES Visual Basic 6 Data Control and Visual Data Manager

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Dim s As String
    Dim A As String

    Private Sub Text1_KeyPress(KeyAscii As Integer)

    If KeyAscii = 13 Then

    s = 'Select from EMP where ENAME='' & Text1.Text & '''

    Adodc1.RecordSource = s
    Adodc1.Refresh
    Set DG.DataSource = Adodc1
    End If
    End Sub
    ' WHERE IS THE PROBLEM IN THIS CODE
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
893
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

MELJUN CORTES Visual Basic 6 Data Control and Visual Data Manager

  1. 1. DATA CONTROL AND VISUAL DATA MANAGER MELJUN CORTES
  2. 2. Using Visual Data Manager    Launch Visual Data Manager from the VB Add-Ins menu.    Choose File/New..., choose Access 7.0, and give the new database a name.    Right-click in the Database Window. (There appears to be no other way to do this, nor any instructions that would lead you to this. I accidentally found it when I was about to give up!) Click New Table in the pop-up menu. In the resulting dialog box, give the new table a name.    Click the Add Field button. Enter a field name and field type. Click the Okay button to add the new field to the list. Keep repeating for a few more fields. When done, click Close to stop adding fields and then close the table dialog.    In the Database Window, you'll see the name of your new table. Doubleclick to open the table so you can add records to the table. You can come back and add more records any time.
  3. 3.      In Visual Data Manager, choose File/Open Database, and open a database file, such as the one you created a few minutes ago. In the Utility menu, choose DataForm Designer... Fill in a name for your form at the top of the Dataform Designer dialog, and set the RecordSource to a (the) table in your database. Click the >> button to add all fields to this form. Click on Build the Form. When it is done,
  4. 4. Data Controls Event      The Error event handles any error that occurs with the database. Use this event to code what you want to happen when an error occurs. The Reposition event occurs when the user moves to another record in the RecordSet. The Validate event occurs prior to updates, either because of moving to another record or explicitly asking for an update to occur. Use this event to do any validation on any of your form fields prior to writing to the database. If a field is invalid, you can cancel the update and the action that caused it by setting Action=0 and Save=False.
  5. 5. RecordSource and RecordSet Properties  The RecordSource tells where the data will come from. You can think of the Recordset property as the actual data that you've requested using the RecordSource.
  6. 6. RecordSet Methods        Data1.RecordSet.AddNew Data1.RecordSet.Delete Data1.RecordSet.MoveNext Data1.RecordSet.MovePrevious Data1.RecordSet.MoveFirst Data1.RecordSet.MoveLast Data1.UpdateRecord
  7. 7. RecordSet Properties      Data1.RecordSet.EOF -True if MoveNext has moved us past the last record Data1.RecordSet.BOF - True if MovePrevious has moved us in front of the first record Data1.RecordSet.RecordCount - The number of records in the RecordSet. This is accurate with small RecordSets. For large RecordSets you may have to perform a MoveLast to get this actual value. Data1.RecordSet.AbsolutePosition - The number of the current record in the RecordSet. Starts at zero. This property does not appear to be reliable in VB6. I put code to display this in the Data Control's Reposition event, and sometimes it worked, sometimes it gave odd results. Data1.RecordSet!fieldname - The contents of a specific field in the current record of the RecordSet. Replace fieldname with the valid name of a field.
  8. 8. Other Codes For Data Control   Syntax : Data1.DatabaseName = App.Path & “ databaseName.mdb” – Using this code you may be able to move your application to other folders and it will not crash. s = Data1.Recordset!ZipCode – where s is declared as string. You can directly pass the value of the Zipcode field to s.

×