Hi,
Help me to get the following program working..It is a simple example of a database
but I get a"Compile error" saying "User-defined type not defined" for the underlined lines below...
Could you please correct my code?
thanks...
VB Code:
  1. Dim [U]rsMyRS As Recordset[/U]
  2. Dim dbMyDB As Database
  3. Private Sub cmdUpdate_Click()
  4. rsMyRS.Edit
  5. rsMyRS!Phone = txtPhone.Text
  6. rsMyRS.Update
  7. End Sub
  8. Private Sub cmdDelete_Click()
  9. rsMyRS.Delete
  10. lstRecords.RemoveItem lstRecords.ListIndex
  11. End Sub
  12. Private Sub cmdNew_Click()
  13. rsMyRS.AddNew
  14. rsMyRS!Name = "A New Person"
  15. lstRecords.AddItem rsMyRS!Name
  16. lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID
  17. rsMyRS!Phone = "Person's Phone Number"
  18. rsMyRS.Update
  19. End Sub
  20. Private Sub Form_Load()
  21. Set dbMyDB = OpenDatabase("C:\MyDatabase.mdb")
  22. Set rsMyRS = dbMyDB.OpenRecordSet("MyTable", dbOpenDynaset)
  23. If Not rsMyRS.EOF Then rsMyRS.MoveFirst
  24. Do While Not rsMyRS.EOF
  25.     lstRecords.AddItem rsMyRS!Name
  26.     lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID
  27.     rsMyRS.MoveNext
  28. Loop
  29. End Sub
  30. Private Sub lstRecords_Click()
  31. rsMyRS.FindFirst "ID=" & Str(lstRecords.ItemData(lstRecords.ListIndex))
  32. txtPhone.Text = rsMyRS!Phone
  33. End Sub