Senin, 27 Mei 2019

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

 

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 8 strive4peace2008@yahoo.com [MS_Access_Professionals] wrote:
 

? is supposed to be space ...

On 5/26/2019 3:25 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] wrote:

oops!

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

On 5/26/2019 3:23 PM, crystal 8 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 duanehookom@hotmail.com [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 thaw5@suddenlink.net [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 <thaw5@suddenlink.net>
------------------------------------


------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
??? http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
??? Individual Email | Traditional

<*> To change settings online go to:
??? http://groups.yahoo.com/group/MS_Access_Professionals/join
??? (Yahoo! ID required)

<*> To change settings via email:
??? MS_Access_Professionals-digest@yahoogroups.com
??? MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
??? MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
??? https://info.yahoo.com/legal/us/yahoo/utos/terms/


__._,_.___

Posted by: Steve thaw5 <thaw5@suddenlink.net>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar