CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    9

    Unhappy unique student number ADODC

    good day everyone!
    newbie in dbms abd vb here.,

    i am having trouble automating student
    number.,
    i use this code to automate a unique student number.,

    Code:
    Dim uh As Integer
            
            uh = Data1.Recordset.RecordCount
            
            If uh = 0 Or uh < 10 Then
                
                MaskEdBox2.Text = "2009-000" & uh
    
            ElseIf uh = 10 And uh < 100 Then
            
                MaskEdBox2.Text = "2009-00" & uh
                
            ElseIf uh = 100 And uh < 1000 Then
            
                MaskEdBox2.Text = "2009-0" & uh
                
            ElseIf uh > 1000 And uh < 10000 Then
            
                MaskEdBox2.Text = "2009-" & uh
            
            Else
                
                MaskEdBox2.Text = "2009-"
                
            End If
    now it does it job correctly..
    but when i try to delete a record.,
    lets say i have added records with student numbers from :
    2009-0000,2009-0001,2009-0002,2009-0003,2009-0004

    when i try to delete lets say 2009-0002
    and tried to add another record the code brings the student number 2009-0004.,which should not because im trying to create a unique student number,.
    the next studnumber should be 2009-0005.,

    any help and explanation,.i'll be very thankful.,

    thanks..

  2. #2
    Join Date
    Oct 2009
    Posts
    9

    Re: unique student number ADODC

    sorry..
    my mistake with the title..
    its a data control..

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

Featured