Rabu, 07 Agustus 2013

RE: [MS_AccessPros] Re: Move data from a main form to a subform

 

Luigi-

If I understand you, you display the results of an ODBC query in the main
form, and want to provide a button to save certain records to a local table.
I wouldn't use a subform for that. Provide a button to create a new record
in the local table and open a popup or dialog form to further edit that
record. Your code will also need to verify that there isn't already a local
copy of the record before you do the copy.

You mention something called a "synchro ID" - is that the key from the ODBC
table? If so, I would write that to the local table so you can easily check
if a record already exists. Basically, you need to check the local table
for a record, insert it if it doesn't already exist, perhaps update the
existing record with the current data, then display the local record in
another form. You will need to execute INSERT or UPDATE queries in your
code as well as a DoCmd.OpenForm with a filter for the matching local
record. Without knowing the specific field and table names, it's difficult
to provide you with specific code.

To do an INSERT, you will do something like:

Dim strSQL As String

strSQL = ... assemble the INSERT statement here using values from the
main form
CurrentDb.Execute strSQL, dbFailOnError

Hope that gets you started...

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of bondurri.luigi
Sent: Wednesday, August 07, 2013 6:18 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Move data from a main form to a subform

Hi John, let me explain better, what u wrote is correct but in the msin form
I get data from various odbc not writeable tables, and the main form is
composed by some data e some subforms.
I've to create a budget tool, so salesguys have to visualize customers,
product details, prices of the last few years... and make the budget for the
next... so in this subform, I've to write the customer id, product id, last
price ir better an average of prices, and once I've these data, salesguys
must have the rights to modify quantities, prices ecc..

This is why Ive to copy more then the synchro id that is automatic..
Dunno if it is clear...

Thanks and again have a good august! Ciao Luigi

--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...>
wrote:
>
> Luigi-
>
> Why do you want to do that? What is the business problem you're
> trying to solve? Normally, a subform contains data in a table in a
"child"
> relationship with the data bound to the outer form, and the link
> fields are synched automatically by Access if you set the Link Master
> and Link Child properties of the subform control correctly. You
> should never have to copy data from a main form to a subform.
>
> John Viescas, Author
> Microsoft Access 2010 Inside Out
> Microsoft Access 2007 Inside Out
> Microsoft Access 2003 Inside Out
> Building Microsoft Access Applications SQL Queries for Mere Mortals
> http://www.viescas.com/ (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of
> bondurri.luigi
> Sent: Wednesday, August 07, 2013 2:32 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Re: Move data from a main form to a subform
>
> Hi all,
> I've a similar question (I suppose :-)) I would like to copy some data
> from the main form to a subform, by clicking a button. If I syncronize
> the subform automaticaly I can copy the synchronized field
> (IDMain=IDSubform) but how can I copy some other data (code, name,
> ecc) related to the same IDMain to the IDSubform? pratically Append a
> record to the subform getting it from main form...
> Thnaks and have a nice august !
>
> --- In MS_Access_Professionals@yahoogroups.com, "luvmymelody"
> <luvmymelody@> wrote:
> >
> > Hello all,
> >
> > I have a main form that sometimes I would like to add the data to a
> subform that is not related to each other.
> >
> > The subform is a subform that will at the click of a button add a
> > task in
> Microsoft Outlook.
> >
> > Is there a way of copying data to the subform by a click of a button?
> >
> > Thank You for your help
> >
> > Jim Wagner
> >
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

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

Yahoo! Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar