FIND Speciffic record and USE it using VBA (1 Viewer)

voskouee

Registered User.
Local time
Yesterday, 19:36
Joined
Jan 23, 2007
Messages
96
I have a table with country names and currencies. I am using VBA and am opening a recordset and i want to FIND AND USE use only one speciffic record from that recordset. how do i do it?

any ideas?

i know i can use the find method of the recordsets... how can i use it after i find it.. how do i declare it?

this will use all the rates in the list... for the first one only what do i do?

Set RsType = CurrentDb.OpenRecordset("SELECT SOBP,SOBPDEBIT FROM RFGDebitNotes ;")
Set RsTbl = CurrentDb.OpenRecordset("SELECT * FROM " & RsType!sobpdebit & " ;")
Set RsCur = CurrentDb.OpenRecordset("SELECT SOBP, CUR from CURRFG;")

Do While Not RsType.EOF

DoCmd.SetWarnings (False)

strDBCura = "Update " & RsType!sobpdebit & " set DebitDBN = Debits * " & Val(RsCur!CUR) & ";"
 
Last edited:

Bodisathva

Registered User.
Local time
Yesterday, 22:36
Joined
Oct 4, 2005
Messages
1,274
Replace the RsCur with a DLookup...

strDBCura = "Update " & RsType!sobpdebit & " set DebitDBN = Debits * " & DLookup("CUR","CURRFG", "SOBP = '" & RsType!SOBP & "';"

I wrapped the criteria of the DLookup with single quotes, assuming it was a string, if it's a number, remove them. Alternatively, you can also establish the RsCur recordset within the loop as long as you add the WHERE critera.
 

voskouee

Registered User.
Local time
Yesterday, 19:36
Joined
Jan 23, 2007
Messages
96
can i replace the SOBP = with a speciffic value?

where does the column closes?
 

voskouee

Registered User.
Local time
Yesterday, 19:36
Joined
Jan 23, 2007
Messages
96
Thank you so much my friend.. and this is not the first time you helped me..

i appreciate that you are sharing your knowledge..
 

a_20120

tan
Local time
Today, 07:06
Joined
Nov 21, 2006
Messages
175
I dont know what is the problem:
Me.STFamily.Value = DLookup("[ST_Family]", "STUDENT", "[ST_ID] = Me.cboStudent ")

ST_ID is numeric type
 

a_20120

tan
Local time
Today, 07:06
Joined
Nov 21, 2006
Messages
175
For numerical values:

DLookup("FieldName", "TableName", "Criteria = " & forms!FormName!ControlName)

This helped me
 

Users who are viewing this thread

Top Bottom