IsConnected("Select count(ID) from transaction", False)

            If myDR.Read = True Then
                Me.TextBox1.Text = myDR.GetValue(0) + 1
            Else
                Me.TextBox1.Text = 1
            End If
            TextBox1.Focus()
        End If

im going to ask how can i make my autonumber like these "10001" instead of "1"

can anyone help me to fix my code??

Recommended Answers

All 2 Replies

Member Avatar for Unhnd_Exception

Surely you couldn't just add 10,000.

What is your ID column? is it an identity column. If it is couldn't you just start the seed at 10001.

If its and your using it as an identity: count(id) is not very good. You would be better with max(id). You'll run into issues where the count could be 10 and assign it to something then something gets deleted and something gets added and the next value from count(id) will be 10 as well.

Not exactly sure what your doing. Go ahead and post some more.

See if this helps.

Me.TextBox1.Text = CInt(myDR.GetValue(0) + 1).ToString("10000")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.