Senin, 27 Mei 2019

Re: [MS_AccessPros] Record count for INSERT INTO, UPDATE

 

you're welcome, Steve ~ happy to help

have an awesome day,
crystal

free code you can use in your projects
https://msaccessgurus.com/code.htm

On 5/27/2019 3:42 PM, Steve thaw [MS_Access_Professionals] wrote:
Thank you Duane and Crystal. I was anticipating a cryptic and difficult task, but it turned out to be elegantly simple:

?? Dim strUPDATE As String, strINSERT As String
?? Dim RecordsUpdated As Long, RecordsInserted As Long

?? With CurrentDb
????? .Execute strINSERT
????? RecordsInserted = .RecordsAffected
????? .Execute strUPDATE
????? RecordsUpdated = .RecordsAffected
?? End With


Appreciate the help and advice!

Steve


On 5/26/2019 7:47 PM, crystal [MS_Access_Professionals] wrote:
?

? is supposed to be space ...

On 5/26/2019 3:25 PM, crystal [MS_Access_Professionals] wrote:

oops!

with Currentdb
?.execute sSQL
?nNumberRecords = .RecordCount
end with

On 5/26/2019 3:23 PM, crystal wrote:

hi Steve,

adding on to Duane's comment ...

dim nNumberRecords as long _
,sSQL as string

sSQL = "blah blah"

with me.currentdb
?.execute sSQL
?nNumberRecords = .RecordCount
end with

~crystal

On 5/26/2019 1:48 PM, Duane Hookom [MS_Access_Professionals] wrote:

Consider using .Execute in place of the DoCmd. This exposes the RecordsAffected property.

Duane



On May 26, 2019, at 1:04 PM, "Steve thaw5 [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:

I am using DoCmd.RunSQL with INSERT INTO and UPDATE action queries. Is
there a way to get the number of records inserted or updated for use in?
a debug.print statement?

Thanks.

Steve


------------------------------------
Posted by: Steve thaw5
------------------------------------

__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)

SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar