Results 1 to 3 of 3

Thread: can't save combobox

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2010
    Posts
    1

    can't save combobox

    I'm so newbie. Badly need ur help. on a form i put a combobox retrieved from a different table. it works fine. but when i filled in all the entries and saved them, it didn't save. still empty. before is used the combo, it was just fine.
    here's the script ( a little), for a start. btw, it's vb6.
    Code:
    Private Sub Form_load()
    Set wjt = CreateWorkspace("", "admin", "", dbUseJet)
    Set a = wjt.OpenDatabase("D:\My Documents\VB_Practice\db1.mdb")
    Set a = OpenDatabase("D:\My Documents\VB_Practice\db1.mdb")
    Set b = a.OpenRecordset("student")
    Set f = a.OpenRecordset("select distinct (class)  from rombel")
    
    cboclass.Text = f!class
        
            With cboclass
            .Clear
       On Error Resume Next
       If f.RecordCount = 0 Then
       MsgBox "type in data", vbOKOnly
        
            Else
                      f.MoveFirst
            Do Until f.EOF
                .AddItem f(0)
            
                f.MoveNext
        
            Loop
           End If
           End With
     
       Return
    
        If b.RecordCount = 0 Then
    Call empty
    Else
    b.MoveFirst
    End If
    change= False
    End Sub
    Here's the save script:
    Code:
    Private Sub save_Click()
    b.AddNew
    b!no = tno.Text
    b!nisn = tnisn.Text
    b!class = cboclass.Text
    b!name = tname.Text
    b!sex= tsex.Text
    b.Update
    Call empty
    tno.SetFocus
    End Sub
    after clicking save, and click the next button, it show "no current record" [runtime error '3021']

    i assumed it's bcoz of the combobox which is probably not properly set.
    any idea? please.

    tx b4
    Last edited by si_the_geek; Sep 12th, 2010 at 01:52 PM. Reason: added Code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width