access vba - Match previous record after SQL Select -


i'm trying build on code don't know how tackle 2nd part of code. in beginning code in sql selected record's caseid, program, , language table intake assignedto null. working fine.

once record selected, want code checks if selected record's caseid matches caseid of previous record. lost. here at:

set db = currentdb  strsql = "select top 1 intakeid, caseid, [program], [language] intake assignedto null" set rs = db.openrecordset(strsql, dbopendynaset)  = rs!caseid if dlookup("caseid", "intake", i)  call getpreviousworker 

i know i'm not using dlookup properly, i'm attempting find matching record , failing haha. thank can :)

i think intakeid primary key incrementing 1 in intake table

so requriement can achieve below

set db = currentdb  strsql = "select top 1 intakeid, caseid, [program], [language] intake assignedto null" set rs = db.openrecordset(strsql, dbopendynaset)   while not rs!eof  strsql = "select intakeid, caseid, [program], [language],[other required fields]              intake intakeid=" & rs!intakeid - 1 set rs1 = db.openrecordset(strsql, dbopendynaset)   if rs!caseid = rs1!caseid    in case..update or something..  else //means current record case id not equal previous 1  ..  end if  rs.movenext wend 

hope helps


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -