Em Andamento

Need an automatically reset counter

Need a VBA code that will automatically generate a 5 digit number in the form of (month "-" and sequence) ie: 06-150 or 12-873. I need this number to automatically reset to 001 when the month changes. The database I am working with is Access 2002. I just need the VBA code and EXPLICIT instructions as to how to set up the table and the install the code. I am very new to VB so please dont take for granted I will know certain steps. This is a small part of a much larger project. So if the work is fast, fairly priced and well executed, we will have more projectys to discuss.

Here is the code that I have worked on myself

Option Compare Database

Private Sub cmd1_Click()

Dim LocalConnection As [url removed, login to view]

Dim rJN As [url removed, login to view]

Dim cMonth As Integer

Dim cYear As Integer

Dim vYear As Integer

Dim vMonth As Integer

Dim vNum As Integer

Set LocalConnection = CurrentDb()

Set rJN = [url removed, login to view]("TEST")

[url removed, login to view]

vYear = Val(Left$(rJN(0), 2))

vMonth = Val(Mid$(rJN(0), 3, 2))

vNum = Val(Right$(rJN(0), 3))

cYear = Year(Now)

cMonth = Month(Now)

If vMonth = cMonth Then

rJN(0) = rJN(0) + 1

Else

[url removed, login to view](0) = (cMonth) + (cYear) + ("001")

End If

[url removed, login to view] = rJN(0)

End Sub

There are problems with this code and it is not returning the result I need. The number generated in the table should be (month, year and sequence) ie 082003500 and the number visible needs to be 08-500. I haven't worked on that part yet because I am having too many problems with the number generating part.

thanks

## Deliverables

Code snippet and Very Cleear instructions as to how to set it up. Complete ownership and distribution copyrights to all work purchased.

## Platform

VBA

Habilidades: Engenharia, Microsoft Access, MySQL, PHP, Arquitetura de software, Teste de Software, Visual Basic

Ver mais: access reset counter month, vba right, right vba, end vba, vba compare, val , automatically, generate digit code php, recordset, will granted code, vba small code, openrecordset, access vba php, small vba, vba code compare, small basic vba, small access project 2003, project vba access, working vba database, DAO, vba small, digit part number, php counter reset month, compare access database, visual basic test table

Acerca do Empregador:
( 5 comentários ) United States

ID do Projeto: #2973866

Premiar a:

TakeReal

See private message.

$11 USD em 5 dias
(1276 Avaliações)
7.5

3 freelancers estão ofertando em média $16 para este trabalho

yadidvw

See private message.

$25.5 USD in 5 dias
(16 Comentários)
4.4
wpcortes

See private message.

$12.75 USD in 5 dias
(1 Comentário)
0.0