Hi
i have 2 forms in my VB6 project(frmPrompt and frmKeyword).When I click on save in the frmkeyword form,I save the source text as ssource=txtsource.text,sdate=txtdate.text then I hide frmKeyword and I show frmPrompt,
VB Code:
  1. Public ssource as string
  2. Public sdate as string
  3. 'frmKeyword
  4. Private sub cmdSave_click()
  5. ssource=txtsource.text
  6. sdate=txtdate.text(I use a datepicker for the date)
  7. frmKeyword.Hide
  8. frmPrompt.Show
  9. the frmPromt contains a datepicker,and 2 comboboxes(a cbolanguage and cbosource)
  10. when frmPrompt loads i want to hightlight in the cbosource the source(ssource) and I want to hide the Date picker and display a label containing sdate
  11. 'frmPrompt
  12.  
  13.  
  14. Private Sub Form_Load()
  15. Dim i As Integer
  16. Dim sa As String
  17. DTPicker.Visible = False
  18. lbldate.Visible = True
  19. lbldate.Caption = sdate
  20.  
  21. Rs2.Open "Select*from Source where SourceID=" & nar, SICA, adOpenStatic, adLockOptimistic
  22. sa = Rs2!ArticleLanguage
  23. Rs2.close
  24. Select Case sa
  25. Case "Arabic"
  26. cbolanguage.ListIndex = 0
  27. Case "English"
  28. cbolanguage.ListIndex = 1
  29. Case "French"
  30. cbolanguage.ListIndex = 2
  31. End Select
  32. For i = 0 To cbosource.ListCount
  33. If nar = cbosource.ItemData(i) Then
  34. cbosource.ListIndex = i
  35. End If
  36. Next i
  37. Display
  38. End Sub
  39.  
  40. Private Sub cbolanguage_Click()
  41. Dim slang As String
  42. slang = cbolanguage.List(cbolanguage.ListIndex)
  43. cbosource.Clear
  44.  
  45. Rs2.Open "select * from Source where ArticleLanguage='" & slang & "'", SICA, adOpenStatic, adLockOptimistic
  46.  
  47. Rs2.MoveFirst
  48.  
  49. Do While Not Rs2.EOF
  50.     cbosource.AddItem Rs2!ArticleSource
  51.     cbosource.ItemData(cbosource.NewIndex) = Rs2!SourceID
  52.     Rs2.MoveNext
  53. Loop
  54.  
  55. Rs2.Close
  56. cbosource.ListIndex = 0
  57. End Sub
  58.  
  59.  
  60. Public Sub Display()
  61. Dim acount As Integer
  62. If nar <> 0 Then
  63. Rs1.Open "Select * from Article where SourceID = " & nar & " and Flag = 0 and ArticleDate like '" & sdate & "' ", SICA, adOpenStatic, adLockOptimistic
  64. Do While Not Rs1.EOF
  65.    sCompleteFile = Trim(Rs1!CompleteFile)
  66.    lstArticle.AddItem sCompleteFile
  67.    acount = acount + 1
  68.    Rs1.MoveNext
  69.    Loop
  70. Rs1.Close
  71. End If
  72.  
  73. End Sub

For example,if in frmKeyword txtsource=DailyStar and sdate="21/04/2006"
I want when the frmPrompt loads to display 21/04/2006 in a label control(hide the datepicker) and highlight DailyStar in its corresponding combobox(cbosource) and display the updated list of Articles based on Rs1.Open "Select * from Article where SourceID = " & nar & " and Flag = 0 and ArticleDate like '" & sdate & "' ", SICA, adOpenStatic, adLockOptimistic

But it didn't work.
Can anyone help me to debug my code(the first event is save_click)