Ok, Being less experienced in knowing which is the best/fastest way to do things - I'm asking this question.
Which is faster? and is there a faster way than what I'm doing?
I want to know if there exists 1 or many items with a certain ID in it's foreign key, to find out if this situation exists, which method is the fastest? I've achieved it by the following:
rst.Open "SELECT [tbDailyOtherTickets].[OffsetToID], [tbDailyOtherTickets].[TypeID], [tbDailyOtherTickets].[CategoryID] FROM tbDailyOtherTickets WHERE ((([tbDailyOtherTickets].[OffsetToID])= " & [Forms]![adjustmentsProof]!ID & "
And (([tbDailyOtherTickets].[TypeID])=16) And (([tbDailyOtherTickets].[CategoryID])=8));", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rst.RecordCount > 0 Then
'some code
end if
rst.close
also, I can have a saved query with parameters that I pass at run time. (this way I can reuse each query) eliminating the reference to forms (I can pass it at run time)
using a saved query I can do the following:
set qd = currentdb.querydefs("MyQueryName"
qd!listid = me.openargs
qd.execute
if qd.returnsrecords = true then
'some code
end if
set qd = nothing
If anyone knows of a site, or resource that can tell me which methods and ways of doing things are the fastest and most efficient i'd greatly appreciate it.
Thank you very much in advance.
Randall Vollen
National City Bank Corp.
Just because you have an answer - doesn't mean it's the best answer.
Which is faster? and is there a faster way than what I'm doing?
I want to know if there exists 1 or many items with a certain ID in it's foreign key, to find out if this situation exists, which method is the fastest? I've achieved it by the following:
rst.Open "SELECT [tbDailyOtherTickets].[OffsetToID], [tbDailyOtherTickets].[TypeID], [tbDailyOtherTickets].[CategoryID] FROM tbDailyOtherTickets WHERE ((([tbDailyOtherTickets].[OffsetToID])= " & [Forms]![adjustmentsProof]!ID & "
If rst.RecordCount > 0 Then
'some code
end if
rst.close
also, I can have a saved query with parameters that I pass at run time. (this way I can reuse each query) eliminating the reference to forms (I can pass it at run time)
using a saved query I can do the following:
set qd = currentdb.querydefs("MyQueryName"
qd!listid = me.openargs
qd.execute
if qd.returnsrecords = true then
'some code
end if
set qd = nothing
If anyone knows of a site, or resource that can tell me which methods and ways of doing things are the fastest and most efficient i'd greatly appreciate it.
Thank you very much in advance.
Randall Vollen
National City Bank Corp.
Just because you have an answer - doesn't mean it's the best answer.