Write in a diferent field

Neowarp

New member
Local time
Today, 08:49
Joined
Dec 23, 2009
Messages
5
I have a doubt ... I want to write in a field a value and when losefocus i want to do a search for in a particular table and write the result in this field ... how can I do this?
Thanks
 
You could use the DLookup() function....DLookup(expr, domain, [criteria])

I haven't tried this but...

Private Sub Text16_LostFocus()
me.Yourtextboxnamehere = DLookup(expr, domain, [criteria])
End Sub

if that don't work, I hope it helps point you in the right direction.
Let me know
Larry
 
I'me really really new in this things ... I can't put this to work ... Can you explain the simple way you can to this very stupid man?
 
Could you post a sample DB? I'll make sure it works then send it back.
 
to do what i'm asking for exists this code in one of the fields :

Private Sub formando_n_doc_LostFocus()
Set formando = CurrentDb.OpenRecordset("formando")

Dim controlo As Integer

With formando

Do Until .EOF
.Edit

If Me.formando_n_doc = formando.formando_n_doc Then

Me.formando_id = formando.formando_id
Me.formando_nome = formando.formando_nome

controlo = 1

End If


.Update
.MoveNext

Loop

If controlo = 0 Then

Me.formando_nome = ("O Formando não existe!")
Me.formando_id = ""
Me.formando_n_doc = ""
End If
End With

End Sub


this is the correct way or exist one more simple form to do it?

This code works but when there is more than 1 person connected to the database it takes about 1 minute to show the result ...

If is necessary i wil send the database to you but this is a split database and i must to join again the db ...
 
I may be misunderstanding what you are after. is it a performance issue?
 
It's also a performance issue ... if i had a rapid answer from the form my problem is resolved ... Anyone have a ideia to speed up this? All the other form work fine and very fast ...

And i can't use a list or combo box ... the field formando_n_doc is a number and exist almost 10000 in the database ... i have to write a number in a textbox ... it's easier that way ...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom