Newsgroup: it.comp.appl.access
Titolo: enabled su controllo se il record corrente è l'ultimo

Ciao a tutti .
Per impostare la proprietà enabled ad un controllo di una maschera se il
record corrente è l'ultimo faccio così
If Me![id_data_fattura] = DLast("[id_data_fattura]",
"T_fatture_carico_unione", "[id_data_fattura]=" &
[Forms]![M_carico_unione]![id_data_fattura]) Then
        Me.recordprec.SetFocus
        Me.recordsucc.Enabled = False
End If
ma la condizione in questo modo è sempre vera.
In un caso analogo invece non avevo avuto problemi.
Ci date un occhio e mi date un vostro parere ?
Grazie
ps il controllo recordprec riesiede su una form e all'interno ha una subform
associate entrambe a tabelle.

 ha scritto nel messaggio
news:cpf50g$u9f$1...@lacerta.tiscalinet.it...

Forse mi perdo qualche pezzo.
La Form nella quale stai gestendo la navigazione ha un Recordset
esplorabile, perchè usi Dlast....?
Usa un controllo su RecordsetClone:
'Aggiorni per sicurezza il BookMark del RecordsetClone
Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
'Per il CommandButton "Successivo"
Me.RecordsetClone.MoveNext
Me.recordsucc.Enabled=Not Me.RecordseClone.Eof
'Ripristini il BookMark dopo esserti mosso
Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
'Per il CommandButton "Precedente"
Me.RecordsetClone.MovePrevious
Me.recordsucc.Enabled=Not Me.RecordseClone.Bof
'Ripristini il BookMark dopo esserti mosso
Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
Ciao
-- 
@Alex (Alessandro Baraldi)
---------------------------------------------------------------------------
http://www.sitocomune.com/
http://www.mantuanet.it/alessandro.baraldi/
---------------------------------------------------------------------------

 ha scritto nel messaggio
news:cpf6hs$vl6$1...@lacerta.tiscalinet.it...


Ciao Alex,
grazie per la risposta. Mi segnale questo:
"riferimento alla proprietà parent non valido nell'espressione"
Ciao

 Ciao
Che versione di Access usi...?
Probabilmente non hai i riferimenti alle Librerie DAO.
Dalla modalitą Codice---Strumenti --->Riferimenti---Cerca e Flagga
"Microsoft DAO 3.6"
se non usi ADO (Microsoft Activex Data Object 2.8) deselezionalo.
Ciao
-- 
@Alex (Alessandro Baraldi)



Il problema è che secondo me non ho ben recepito il primo tuo post :
    Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
    Me.RecordsetClone.MoveNext
    Me.recordsucc.Enabled = Not Me.RecordsetClone.EOF
    Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
    DoCmd.GoToRecord , , acNext
questo nel commandbutton successivo
e questo nel  command button precendete :
    Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
    Me.RecordsetClone.MovePrevious
    Me.recordsucc.Enabled = Not Me.RecordsetClone.BOF
    Me.RecordsetClone.Bookmark = Me.Parent.Bookmark
    DoCmd.GoToRecord , , acPrevious
Avevo fatto anche questa prova per intercettare l'utimo record, ma su
corrente la condizione è vera e non va bene
If Me.CurrentRecord = Me.RecordsetClone.RecordCount Then
   MsgBox ("sono l'ultimo")
End If
Cosa non ho capito ??
Grazie.

 Grazie.
Innanzitutto devi decidere di centralizzare la gestione dei Pulsanti di
Navigazione.
Il controllo di posizione dovrebbe essere gestito su Evento Current.
Nell'Evento chiami una Function che analizza la posizione e ne condiziona
i CommandButton
Ovviamente dato che muovendo il RecordsetClone in EOF ed in BOF devi
inseriere
la gestione Errori On Error Resume next altrimenti si pianta...!
Io ad esempio la gestisco in questo modo:
Private Sub Form_Current()
    EnableDisableButtons
End Sub
Public Sub EnableDisableButtons()
   ' Check and see which Buttons should be enabled/disabled
   ' based on the current row of the recordset.
   Dim RecNum As Long
   On Error Resume Next
   ' Update our Nav info
   Me.txtPos.value = Me.CurrentRecord
   ' If lblNumRecords is blank then this is the
   ' first time through and the recordset pointers
   ' may not be updated yet. We need to allow time
   ' for them to get updated.
   If Me.lblNumRecords.Caption = "" Then
       Me.RecordsetClone.MoveLast
       DoEvents
   End If
   RecNum = Me.RecordsetClone.RecordCount
   Me.lblNumRecords.Caption = " di " & RecNum & strFilter
   ' Are we on a NEW record
   If Me.NewRecord = True Then
       ' Update our nav info.
       'Me.txtPos.Value = "New Record"
       Me.txtPos.value = Me.Parent.RecordsetClone.RecordCount + 1
       Me.lblNumRecords.Caption = " di " &
Me.Parent.RecordsetClone.RecordCount + 1 & strFilter
       Me.txtHidden.SetFocus
       Me.cmdNext.Enabled = False
       Me.cmdPrevious.Enabled = True
       Me.cmdNew.Enabled = False
       Exit Sub
   End If
   'If we reach here, we know we are not in a new record
   'so we can enable the <New> button
   'But we need to check if there are no records. If so,
   'we disable all buttons except for the <New> button.
   Me.cmdPrevious.Enabled = True
   Me.cmdNext.Enabled = True
   If MeRecordsetClone.RecordCount = 0 Then
       'Me.cmdFirst.Enabled = False
       Me.cmdNext.Enabled = False
       Me.cmdPrevious.Enabled = False
       Me.cmdLast.Enabled = False
   Else
       'Synchronise the current pointer in the two recordsets
       Me.RecordsetClone.Bookmark = Me.Bookmark
       'If there are records, see if we are on the first record
       'If so, we should disable the <First> and <Prev> buttons
       With Me.RecordsetClone
           .MovePrevious
           If .BOF Then
               Me.txtHidden.SetFocus
               Me.cmdPrevious.Enabled = Not (.BOF)
               Exit Sub
           End If
           .Bookmark = Me.Bookmark
           .MoveNext
           If .EOF Then
               Me.txtHidden.SetFocus
               Me.cmdNext.Enabled = Not (.EOF)
               Exit Sub
           End If
          .Bookmark = Me.Bookmark
       End With
   End If
End Sub
Porta pazienza per eventuali erorri ma ho stralciato solo quello che
potrebbe
esserti utile da una Routine molto elaborata.
Io ho inserito una TextBox chiamata txtHidden per eliminare il problema del
Focus
l'ho impostata con dimensioni 0,0 per non vederla ma per poterla usare.
Se guardi il Codice c'è anche la gestione della TextBox "txtPos" per
indicare
il Record Corrente e l'Etichetta "lblNumRecords" per il Numero di Records.
Tieni presente anche la possibilità di Muoverti su un NEW record.
Quì è gestita anche quella.... errori di CUT/COPY a parte....!


 il Record Corrente e l'Etichetta "lblNumRecords" per il Numero di Records.
****ok
Ho messo la public sub in un modulo standard :
Ho questo problema:
Me.txtPos.Value = Me.CurrentRecord utilizzo non valido della parola chiave
me
e questo me lo segnala in rosso
Me.lblNumRecords.Caption = " di " & Me.Parent.RecordsetClone.RecordCount 1 &
strFilter
Ci dai ancora un occhio ?

Graham's daughter. It is odd that Rosenbaum would choose to
write on such a controversial subject with someone who seems to
be such a friend to the Post. Related to that, in his 1991
reflections on the 1976 article, and in the article itself, he
tries to insinuate that these people - Bradlee, the Truitts, the
Angletons - are actually friends of Kennedy. In addition,
Rosenbaum and others never seemed to ask why those involved all
seemed so eager to violate Mary's privacy by reading the diary.
In no version I have read was that ever part of Mary's
instructions. And Angleton, the man who the Truitts seem to side
with against Bradlee, supposedly went through them like an
archivist.
The Truitts' trust for and seeming loyalty to the Angletons is
particularly interesting. In Rosenbaum's 1976 piece, the
following passage appears:
  The Truitts were still in Tokyo when they received word of
  the towpath murder, and the responsibility for the diary was
  communicated to their mutual friend James Angleton through
  still uncertain channels.
With the quiet skill of a cardsharp, Rosenbaum avoids an
important detail. Namely, how the Truitts found out about Mary's
death in the middle of the night halfway around the world.
Someone must have either called or wired them. Why is this matter
never addressed in any version? 

instance, when the former report was analyzing the published
details of a Drew Pearson-Jack Anderson 1967 leak about the
Castro plots, it labeled the Pearson-Anderson insinuation about
Robert Kennedy's "approval" of the plots as "Not true." It later
goes on to say that the role played by Robert Kennedy in
Pearson's story is "a garbled account." What had happened was
that through the FBI's discovery of a wiretapping favor done for
Maheu's contact in the plots (Chicago mobster Sam Giancana)
Hoover had learned of the CIA-Mob link and forwarded his
knowledge to Robert Kennedy. Kennedy turned it over to Courtney
Evans, his FBI liaison, and asked him to get back with all the
known details. He was finally briefed on it in May of 1962. There
can be no doubt about his reaction. As one of Bobby's CIA
briefers stated: "If you have seen Mr. Kennedy's eyes get steely
and his jaw set and his voice get low and precise, you get a
definite feeling of unhappiness."
In a memo of a meeting Hoover had with RFK after this briefing,
Hoover wrote: "The Attorney General told me he wanted to advise
me of a situation in the Giancana case which had considerably
disturbed him" [emphasis added]. For his own part, Hoover wrote
of his talk about the matter with the AG:
  I expressed great astonishment at this [the association] in
  view of the bad reputation of Maheu and the horrible
  judgment in using a man of Giancana's background for such a
  project. The Attorney General shared the same views.
Kennedy had made it clear to the CIA that if they were to have
any more of these types of ideas about using these characters,
they would have to go through the Justice Department first, i.e.
him. But what RFK did not know is that, as the I. G. Report
states:
  It should be noted that the briefing of Kennedy was
  restricted to Phase One of th

Iraq by giving two public speeches before the
Veterans of Foreign Wars (Aug. 26) and the Korean War Veterans (Aug. 29)
in which he publicly touted the Nazi doctrine of preventive warfare
against Iraq. Of course the lap-dog U.S. news media were too obesiant to
observe that while mongering for a war against Iraq before these former
soldiers who had actually gone to war, Cheney had ducked out of the
Vietnam War. The same was true for Wolfowitz and the rest of the Bush
Jr. administration's Straussian Neo-Con cabal. They were too busy
studying Machiavelli and Nietzsche with Strauss, Bloom, and their
acolytes from the University of Chicago. Chickenhawks to a man. Bush Jr.
too. The American Power Elite are more than happy to send the children
of poor Blacks, Latinos and Whites off to kill and be killed in
Afghanistan, Iraq, and elsewhere. Just like their elitist predecessors
did a generation ago in Vietnam, Cambodia, and Laos. Class warfare
indeed. Finally, in September 2002 the Bush Jr. administration adopted
and officially approved "the National Security Strategy of the United
States," that was transmitted to the U.S. Congress as a declaration of
official policy by the United States of America, fully embracing this
reprehensible, criminal, and Nazi doctrine of preventive warfare.38 I
will not waste the reader's precious time here analyzing this criminal
document in extenso. But it reads like a Nazi war planning document that
could have been introduced into evidence before the Nuremberg Tribunal. 
Certainly its most odious language is: ". . . we recognize that our best
defense is a good offense. . ." In other words, the United States
government has publicly admitted in an official government document that
it is now prepared to wage offensive warfare against its chosen
adversaries around the world irrespective of the 

until the Security Council has taken
measures necessary to maintain international peace and security."
Contrary to conventional wisdom and widespread propaganda, it was the
Bush Jr. administration and the Tony Blair government which perpetrated
an "armed attack" against Iraq and thus triggered Iraq's "inherent
right" of individual and collective self-defense under U.N. Charter
article 51. Not surprisingly, no U.N. Member State came to the defense
of Iraq. Rather, Iraq became the first victim of this Nazi Doctrine of
Preventive Warfare propounded by Bush Jr. and Tony Blair. From the
perspective of international legal history, it is Bush Jr. and Blair who
constitute the real "axis-of-evil"- along the lines of Hitler and
Mussolini. In this regard, Article 6 of the 1945 Nuremberg Charter
provides in relevant part as follows: . . . . The following acts, or any
of them, are crimes coming within the jurisdiction of the Tribunal for
which there shall be individual responsibility: (1) Crimes against
peace: namely, planning, preparation, initiation or waging of a war of
aggression, or a war in violation of international treaties, agreements
or assurances, or participation in a common plan or conspiracy for the
accomplishment of any of the foregoing; . . . . Leaders, organizers,
instigators and accomplices participating in the formulation or
execution of a common plan or conspiracy to commit any of the foregoing
crimes are responsible for all acts performed by any persons in
execution of such plan.
To the same effect is the Sixth Principle of the Principles of
International Law Recognized in the Charter of the Nuremberg Tribunal
and in 

would happen
  again in Quang Ngai province-although with less drastic
  results. The desire of Lieutenant Colonel Barker to mount
  another successful, high enemy body-count operation in the
  area; the desire of Ramsdell to demonstrate the
  effectiveness of his operations; the belief shared by all
  the principals that everyone living in Son My was staying
  there by choice because of Communists...and the basic
  incompetence of many intelligence personnel in the Army-all
  these factors combined to enable a group of ambitious men to
  mount an unnecessary mission against a nonexistent enemy
  force, and somehow to find the evidence to justify it all.
I won't go into all the things that must be true for Hersh to be
correct. I will add that in the definitive book of the subject,
The Phoenix Program, My Lai is described as part of the
Colby/Shackley operation.
After My Lai, the New York Times assigned Hersh to the Watergate
beat. The paper was getting scooped by Woodward and Bernstein at
the Washington Post. For a "crack" reporter, Hersh did not
distinguish himself, especially in retrospect. He basically
followed in the footsteps of the Post. i.e. the whole complicated
mess was a Nixon operation; there was no real CIA involvement;
whatever Hunt and McCord did, no matter how wei

secretary, Loomis worked closely with Hersh on The Target Is
Destroyed. Certainly, one of the most ridiculous statements made
by Hersh would be music to Loomis' ears. Hersh's Holy Grail on
the assassination conspiracy, the cinching piece of the puzzle,
would be "a reel of tape of Oswald getting briefed by Giancana"
(Anson p. 120). With what serious people have learned about
Oswald today, through work by Phil Melanson, John Newman, and
John Armstrong, this is preposterous. The Blakey-Davis whim about
the Mafia hiring a "hit man" who couldn't hit the side of a barn
and used a $12.95 bolt action rifle to do the job, went out the
window when the HSCA closed down. But "crack" reporter Hersh
still buys into it. As he does the idea that Sirhan killed Bobby
Kennedy, proven by the fact that he wrote a blurb praising Dan
Moldea's 1995 whitewash of that case.
Behind all the sordid details of these articles there is a bigger
picture to be outlined. One of the main parts of it is the
increasing ascendancy of tabloid journalism into the major media
outlets, and with it, its concomitant attachment to the lives of
celebrities. More often than not, that translates into the
endless search for sleaze and scandal. This chain on the lives of
the Kennedys has been well described in these articles. The
overall tendency has become so prevalent that, as many have
noted, tabloid sales in the U.S. have d

 Ci dai ancora un occhio ?
Ciao
@Alex
-- 
Posted via Mailgate.ORG Server - 
http://www.Mailgate.ORG

[cut]
Ciao Alex, non ti arrabbiare !
su current della form principale :
If Me.NewRecord Then
    Me.data_fattura = Date + 1
    numero_fattura = DMax("numero_fattura", "[T_fatture_carico_unione]",
"[tipo_contratto] = 2") + 1
    Me.numero_fattura.SetFocus
    Me.recordsucc.Enabled = False
    DoCmd.RunCommand acCmdSaveRecord
  ' con un nuovo record assegno un nuovo numero fattura e la data fattura
incrementate di 1
End If
If Me.CurrentRecord = 1 Then
      Me.numero_fattura.SetFocus
      Me.recordprec.Enabled = False
      Me.recordsucc.Enabled = True
     ' se il record corrente è il primo inabilito il click su bottone
indietro di 1
      ' e abilito il bottone avanti di uno spostando il focus su una txt
nascosta
Else
    If Me.CurrentRecord = Me.RecordsetClone.RecordCount Then
        DoCmd.RunCommand acCmdSaveRecord
        Me.numero_fattura.SetFocus
        Me.recordsucc.Enabled = False
        Me.recordprec.Enabled = True
        ' se il record corrente è l'ultimo inabilito il click su bottone
avanti di 1
        ' e abilito il bottone indietro di uno spostando il focus su una txt
nascosta
    Else
        Me.recordprec.Enabled = True
        Me.recordsucc.Enabled = True
        ' nel caso in cui il record corrente sia in posizione intermedia tra
il primo e l'ultimo
        ' abilito sia avanti di 1 che indietro di 1
   End If
end If
DoCmd.RunCommand acCmdSaveRecord
End Sub
Questo è quanto sono riuscito ad elaborare in questo week-end anche grazie
all'aiuto, anzi, direi che il merito è tutto suo.
Sto parlando di Cinzia.
Non è per mancanza di fiducia nei tuoi confronti ,(anzi!!), ma il 3d con te
l'ho iniziato, quando dall'altra parte con lei ero arrivato fino questo
punto, ed era iniziato per un problema con un'istruzione SQL e poi ho
approfondito il discorso dei pulsanti.
Se vuoi dammi pure un parere !
Ciao, a presto.

 Ciao, a presto.
Ciao anche a te.
@Alex
