Information générale
Catégorie:
Codage, syntaxe et commandes
I changed the code to this, but the selected record is not shown when the form is loaded.
Sub Get_ID()
Dim nKey
Dim db As Database, rst As Recordset, rstValid_Numbers As Recordset
Set db = CurrentDb
Application.SetOption "Confirm Action Queries", 0
Application.SetOption "Confirm Document Deletions", 0
Application.SetOption "Confirm Record Changes", 0
Set rst = db.OpenRecordset("Select Last_id from ID_Lookup;")
nKey = rst.Fields("last_id")
Set rstValid_Numbers = db.OpenRecordset("Valid_Numbers")
rstValid_Numbers.Index = "ID1"
rstValid_Numbers.Seek "=", nKey
Me.Refresh
End Sub
>Looks like you have already filtered the result to a single id, so why is the findfirst needed at all?
>unless in reading this wrong you are going to get a single record if the id exists and nothing if it doesnt.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement