Values from Query

Febrero127

New member
Local time
Yesterday, 18:08
Joined
Apr 3, 2014
Messages
7
How do I grab a value from a query and put in into a textbox?
I need to grab the name that returns.
I have attached an image so you guys can see


Private Sub text_badgeRDM_AfterUpdate()
Dim EMP_ID As String
Dim strsql As String
Dim sqlempinfo As New QueryDef

EMP_ID = Text_BadgeRDM.Value
strsql = strsql & "Select d.user_id, d.user_name "
strsql = strsql & "from dms_user d "
strsql = strsql & "where d.user_id = ('" & EMP_ID & "') "
Set sqlempinfo = CurrentDb.CreateQueryDef("tmpsqlpassthroughlpn")
sqlempinfo.Connect = "ODBC;DSN=RDM SEDC;UID=APPSUP;PWD=APPSUP;DBQ=SEDC;DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;FRL=F;MTS=F;CSR=F;PFC=10;TLO=0;"
sqlempinfo.SQL = strsql
DoCmd.OpenQuery "tmpsqlpassthroughlpn", , acReadOnly

End Sub
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    89.3 KB · Views: 199
I actually already tried that but it gives me a format type error.
 
Please show us what you tried with the dlookup, I think it should work.

As for a query, I think you need to use the query as a recordset to assign individual field value to a control.
 

Users who are viewing this thread

Back
Top Bottom