[AccessD] Films and photos...

Kostas Konstantinidis kost36 at otenet.gr
Sat Nov 19 05:06:54 CST 2016


That's make the trick
Thank's all for your time

Private Sub type_media_AfterUpdate()
If Not IsNull(Me!test) Then
Me.test.Locked = True
Me.file_name.Locked = True
Else
Me.test.Locked = False
Me.file_name.Locked = False
End If

Select Case type_media
Case Is = "Movies photo"
Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " & [ID_films] & "
and [type_media] = " & Chr(34) & Me.type_media & Chr(34))) + 1
Me.file_name = ID_films & "_" & Me.test & ".jpg"

Case Is = "Shooting photo"
'ID_films = Me.ID_films
Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " & [ID_films] & "
and [type_media] = " & Chr(34) & Me.type_media & Chr(34))) + 1
Me.file_name = ID_films & "_g" & Me.test & ".jpg"

Case Is = "Poster photo"
'ID_films = Me.ID_films
Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " & [ID_films] & "
and [type_media] = " & Chr(34) & Me.type_media & Chr(34))) + 1
Me.file_name = ID_films & "_a" & Me.test & ".jpg"

End Select
End Sub



-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Kostas Konstantinidis
Sent: Wednesday, November 16, 2016 11:47 PM
To: 'Access Developers discussion and problem solving'
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Films and photos...

May be that is not the perfect code but at least it works making the half of
the trick :-)) The last step is missing... 
Does anybody help on how to reset the counter for every of the cases?

Thank's a lot for your time
/kostas

Select Case type_media
    Case Is = "Movie photo"
        If Not IsNull(Me!test) Then
            Me.test.Locked = True
            Me.file_name.Locked = True
        Else
            Me.test.Locked = False
            Me.file_name.Locked = False
            Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " &
[ID_films]), 0) + 1
            Me.file_name = ID_films & "_" & Me.test & ".jpg"
        End If
    Case Is = "Shooting photo
        If Not IsNull(Me!test) Then
            Me.test.Locked = True
            Me.file_name.Locked = True
        Else
            Me.test.Locked = False
            Me.file_name.Locked = False
            Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " &
[ID_films]), 0) + 1
            Me.file_name = ID_films & "_g" & Me.test & ".jpg"
        End If
    Case Is = "Poster photo"
        If Not IsNull(Me!test) Then
            Me.test.Locked = True
            Me.file_name.Locked = True
        Else
            Me.test.Locked = False
            Me.file_name.Locked = False
            Me.test = Nz(DMax("[Test]", "ST_media_ph", "ID_films = " &
[ID_films]), 0) + 1
            Me.file_name = ID_films & "_a" & Me.test & ".jpg"
        End If
End Select


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Kostas Konstantinidis
Sent: Tuesday, November 15, 2016 9:09 PM
To: 'Access Developers discussion and problem solving'
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Films and photos...

The form is designed as

SELECT ST_media_ph.aa_st_media, ST_media_ph.ID_films,
ST_media_ph.type_media, ST_media_ph.file_name FROM MT_films INNER JOIN
ST_media_ph ON MT_films.ID_films = ST_media_ph.ID_films;

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Tuesday, November 15, 2016 1:20 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Films and photos...

Thuinking about it, in the After-Update, you still have the value of
PictureName, so you can simplify it to one line:

NextPictureName = Left$(PictureName,5) & _
 Format(Val(mid$(PictureName,6) +1),"00")



On 15 Nov 2016 at 12:30, Kostas Konstantinidis wrote:

> Hi Stuart,
> Thank's for your reply
> The first works perfect, but I can't make the second to work. 
> 
> /kostas
> 
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf 
> Of Stuart McLachlan Sent: Tuesday, November 15, 2016 12:56 AM To:
> Access Developers discussion and problem solving 
> <accessd at databaseadvisors.com> Subject: Re: [AccessD] Films and 
> photos...
> 
> Of the top of my head:
> 
> 1.
> IF VAL(PictureName) <> IdFilms then
> Msgbox "Incorrect Picture ID"
> END IF
>  'Val will return everything up to the first non numeric character 
> 'i.e.
> Val("9999_01") will return 9999.
> 
> 2. 
> LastPictureName  = DMax("PictureName","tblPictures", _ "PictureName 
> like '" & Left$(PictureName,4) & "*'"
> 
> LastPictureID = val(right$(LastPictureName,2))
> 
> NextPictureName = Left$(LastPictureName,5) & Format(LastPictureID +
> 1,"00")
> 
> --
> Stuart
> 
> 
> On 14 Nov 2016 at 21:53, Kostas Konstantinidis wrote:
> 
> > hi all,
> > Into a simple subform I keep photos of various films IdFilms (long
> > Integer) e.g. 9999 PhotoType (Short Text) which contains the words 
> > Poster or Shooting Photo or Film Photo PictureName (Short Text) like
> > 9999_01 to 9999_xx
> > 
> > What I need is:
> > 1. "after PictureName update" to check if it begins with wrong 
> > IdFilms, getting a warning message 2. If it's possible "after update 
> > PhotoType" to get automatically the next PictureName e.g. 9999_02
> > 
> > 
> > thank's
> > /kostas
> > 
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> 
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list