MS Access

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesMS Access

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old April 8th, 2015, 03:46 AM
vartaxe vartaxe is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Apr 2015
Posts: 3 vartaxe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 26 sec
Reputation Power: 0
Vba help

hi,

can't get this to work properly

Code:
Private Sub Numéro_du_projet_Click()
If Len(Me.Numéro_du_projet & "") < 1 Then
     If Me.Localité.Column(2) = "" Or Me.Type.Column(2) = "" Then
          MsgBox "Veuillez renseigner la localité et le type de projet."
          Exit Sub
     End If
     tSeq = Nz(DMax("Séquence", "Projets", "Localité='" & Me.Localité.Column(2) & "' and " & "[Type]='" & Me.Type.Column(2) & "'"), 0)
     hiCount = Nz(DLookup("Compteur", "Projets", "Compteur=" & tSeq & ""), 0) + 1
     Me.Numéro_du_projet = Me.Localité.Column(2) & "-" & Me.Type.Column(2) & "-" & Format(hiCount, "000")
End If
End Sub

Last edited by vartaxe : April 10th, 2015 at 02:55 AM.

Reply With Quote
  #2  
Old April 8th, 2015, 04:42 AM
vartaxe vartaxe is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Apr 2015
Posts: 3 vartaxe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 26 sec
Reputation Power: 0
i need to generate project numbers concatenating two fields and increasing count by 1 (every project number has to be unique) so for instance first project in SPAIN for CABLE should be named ES-CA-1 second one ES-CA-2 but if the third one is for instance in another location or type then counter should check for number to use

location=SPAIN=ES
type=CABLE=CA

Len function was just to see if project already had a project number then it should skip it otherwise it could modify the number which isn't good

Reply With Quote
  #3  
Old April 9th, 2015, 04:21 AM
vartaxe vartaxe is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Apr 2015
Posts: 3 vartaxe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 26 sec
Reputation Power: 0
sample

dropbox.com/s/yjatdlq9wvuh7n1/Projets.accdb?dl=0

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMS Access > Vba help


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap