By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,773 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,773 IT Pros & Developers. It's quick & easy.

searching for a specific record

schatsi
P: 1
hi there

im a vb developer - battling with access :) - 2002
i need to search for a specific record within a table in my current db

this is what i tried

Dim rst As Recordset
Dim imported As String
Set rst = CurrentDb.OpenRecordset("SELECT ImportChecker.DateOfImport, ImportChecker.ImportedAlready, ImportChecker.File FROM ImportChecker WHERE (((ImportChecker.DateOfImport)='" & Format(Now, "dd/MM/yyyy") & "') AND ((ImportChecker.File)='" & fileName & "'))"


Please HELP !!!
May 24 '07 #1
Share this Question
Share on Google+
1 Reply

JConsulting
Expert 100+
P: 603
hi there

im a vb developer - battling with access :) - 2002
i need to search for a specific record within a table in my current db

this is what i tried

Dim rst As Recordset
Dim imported As String
Set rst = CurrentDb.OpenRecordset("SELECT ImportChecker.DateOfImport, ImportChecker.ImportedAlready, ImportChecker.File FROM ImportChecker WHERE (((ImportChecker.DateOfImport)='" & Format(Now, "dd/MM/yyyy") & "') AND ((ImportChecker.File)='" & fileName & "'))"


Please HELP !!!
Expand|Select|Wrap|Line Numbers
  1. Dim rst As DAO.Recordset
  2. Dim imported As String
  3. Dim strSQL As String
  4. ' Where is FileName coming from? the form?
  5. strSQL = "SELECT ImportChecker.DateOfImport, ImportChecker.ImportedAlready, ImportChecker.File FROM ImportChecker" & _
  6. " WHERE ImportChecker.DateOfImport=#" & Format(Now, "dd/MM/yyyy") & "# AND ImportChecker.File='" & FileName & "';"
  7. Set rst = CurrentDb.OpenRecordset(strSQL)
  8.  
see comments in the code
J
May 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.