Hi,
I am curious if we can copy the entire last record in a table with a macro. Can anyone help?
Hi,
I am curious if we can copy the entire last record in a table with a macro. Can anyone help?
Macro can't do that directly. Macro can run an Access append (INSERT SELECT syntax) query object with the OpenQuery method.
VBA can execute an SQL INSERT SELECT statement.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi June,
I'm working with web forms and Sharepoint so I can't use vba or append queries (a total pain). The system limits me to using macros which is pretty inflexible (In addition, its not the full suite of macro options as in the client macros.) I've tried doing a "for" loop, matching the last pkey with the attribute in the field and importing each attribute over in a data macro but it puts the entire site in an invalid state. I'm including the code below (its in XML format):
I cut a bit of the repetitive sections out, but the structureis the same.Code:<?xml version="1.0" encoding="UTF-16" standalone="no"?> <DataMacros xmlns="http://schemas.microsoft.com/office/...on"><DataMacro Name="eqAdd"> <Parameters> <Parameter Name="maxCC" Description="Max ID of [CC]"/> </Parameters> <Statements> <ForEachRecord> <Data Alias="aEQ"> <Reference>equipment</Reference> <WhereCondition>[equipment].[id]=[maxCC]-1</WhereCondition> </Data> <Statements> <CreateRecord> <Data> <Reference>equipment</Reference> </Data> <Statements> <Action Name="SetField"> <Argument Name="Field">dt</Argument> <Argument Name="Value">[aEQ].[dt]</Argument> </Action> </Statements> </CreateRecord> </Statements> </ForEachRecord> </Statements> </DataMacro> </DataMacros>
That is entirely beyond my experience and outside my comfort zone to advise. Maybe there is a Sharepoint forum somewhere you should post question on.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks for trying anyway!
Happy Friday!
Thanks for the reply, we're having SharePoint issues atm but your solution will be great for reference. Thanks again!
Oh, forgot about the new Data Macros in Access 2010. Not familiar with their capability and I have never used macros anyway. Never built a web-based db.
The suggestion does look promising. Good Luck.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
It is working for me. Let me know if it is of help and you get it working for your application. Thanks