Help Changing from the Seek Method

B

Bob

Hi,

I have to change the following seek code to either
findfirst or a string (seek doesn't work with a linked DB)
and I'm not sure how to do it or even what this line is
exactly calling:

MyInfo.Index = "PrimaryKey": MyInfo.Seek "=", Me
("frmFTVPlatform" & Format(ItemCount, "00")), Me
("txtLoanNum" & Format(ItemCount, "00"))


frmFTVPlatform is an option group, with 2 check boxes and
either one is always checked. txtloanNum is the check
boxes' corresponding field and its corresponding table's
field name is LoanNumber from tblPropertyPreservation.

Thanks for your help,
Bob
 
T

Tim Ferguson

I have to change the following seek code to either
findfirst or a string (seek doesn't work with a linked DB)
and I'm not sure how to do it or even what this line is
exactly calling:

MyInfo.Index = "PrimaryKey": MyInfo.Seek "=", Me
("frmFTVPlatform" & Format(ItemCount, "00")), Me
("txtLoanNum" & Format(ItemCount, "00"))

What is is doing is some fancy footwork with values on the form to look up
one record having lifted the entire table into memory. It's better just to
look up one record in the first place vis:-

' I'm not convinced these are right, but still...
' I am also assuming that they are both TEXT values
strPlatform = Me("frmFTVPlatform" & Format(ItemCount,"00"))
strLoanNum = Me("txtLoanNum" & Format(ItemCount, "00"))

' This is the simplest command available
strSQL = "SELECT * " & vbNewLine & +
"FROM tblPropertyPreservation " & vbNewLine & _
"WHERE Platform = """ & strPlatform & """" & vbNewLine & _
" AND LoanNum = """ & strLoanNum & """"

' remove this line once you have the thing working right
MsgBox strSQL

' now get the recordset
' change the parameters if you need to update the record
' rather than looking at it
Set rsMyInfo = db.Openrecordset( _
strSQL, _
dbOpenSnapshot, _
dbForwardOnly )

' now see if it existed
If rsMyInfo.EOF Then
' oh dear, no such record
MsgBox "Oh dear, no such record"

Else
' okay, now do something....



Hope that helps

Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top