I am working with VB.Net 2005 going to an Access 2003 database.

I want to give my user the ability to copy a list of Orders (based on MR #
and PreviousVisitDate) to a new VisitDate when they are creating one. I have
everything ready but I am stuck on how to construct an SQL statement to do
what I need to do. So this is what I have to do..

1. Select all Orders with the specified MR and PreviousVisitDate

2. Copy all of the returned records (to a new temp table??)

3. Change the Date in the returned records to the New Date they entered.

So now I will have the original list and the new list that looks just like
it but with a different Date.

I am sure this is simple for most of you but I am struggling with it. Can
anyone show me an example of how this would be done or point me to one that I
can read through? Thanks for any help you can give me with this.

Re: Copy records, change date, save new... by Patrice

Patrice
Thu May 24 10:48:45 CDT 2007

See the INSERT INTO statement
(http://www.blueclaw-db.com/accessquerysql/sql_insert_into.htm).

Basiclaly it could be somehting like :

INSERT INTO t(a,b,c,d) SELECT a,'Some new value',b,c FROM t WHERE a='xxx'


"cc_crash" <cccrash@discussions.microsoft.com> a écrit dans le message de
news: 54BC9DBF-F82E-46CD-96AD-ED8AB04A11BF@microsoft.com...
>I am working with VB.Net 2005 going to an Access 2003 database.
>
> I want to give my user the ability to copy a list of Orders (based on MR #
> and PreviousVisitDate) to a new VisitDate when they are creating one. I
> have
> everything ready but I am stuck on how to construct an SQL statement to do
> what I need to do. So this is what I have to do..
>
> 1. Select all Orders with the specified MR and PreviousVisitDate
>
> 2. Copy all of the returned records (to a new temp table??)
>
> 3. Change the Date in the returned records to the New Date they entered.
>
> So now I will have the original list and the new list that looks just like
> it but with a different Date.
>
> I am sure this is simple for most of you but I am struggling with it. Can
> anyone show me an example of how this would be done or point me to one
> that I
> can read through? Thanks for any help you can give me with this.
>



Re: Copy records, change date, save new... by Patrice

Patrice
Thu May 24 11:01:04 CDT 2007

To match columns it would be rather :

INSERT INTO t(a,b,c,d) SELECT a,'Some new value',c,d FROM t WHERE a='xxx'

(changed b,c by c,d at the end of the select statement,'Some new value'
being the replacement for the b coluumn. The literal string delimiter may
also vary as I'm using Access quite rarely, utse the usual string delimited
used by Access...)

"Patrice" <http://www.chez.com/scribe/> a écrit dans le message de news:
Okn5EshnHHA.1904@TK2MSFTNGP02.phx.gbl...
> See the INSERT INTO statement
> (http://www.blueclaw-db.com/accessquerysql/sql_insert_into.htm).
>
> Basiclaly it could be somehting like :
>
> INSERT INTO t(a,b,c,d) SELECT a,'Some new value',b,c FROM t WHERE a='xxx'
>
>
> "cc_crash" <cccrash@discussions.microsoft.com> a écrit dans le message de
> news: 54BC9DBF-F82E-46CD-96AD-ED8AB04A11BF@microsoft.com...
>>I am working with VB.Net 2005 going to an Access 2003 database.
>>
>> I want to give my user the ability to copy a list of Orders (based on MR
>> #
>> and PreviousVisitDate) to a new VisitDate when they are creating one. I
>> have
>> everything ready but I am stuck on how to construct an SQL statement to
>> do
>> what I need to do. So this is what I have to do..
>>
>> 1. Select all Orders with the specified MR and PreviousVisitDate
>>
>> 2. Copy all of the returned records (to a new temp table??)
>>
>> 3. Change the Date in the returned records to the New Date they entered.
>>
>> So now I will have the original list and the new list that looks just
>> like
>> it but with a different Date.
>>
>> I am sure this is simple for most of you but I am struggling with it. Can
>> anyone show me an example of how this would be done or point me to one
>> that I
>> can read through? Thanks for any help you can give me with this.
>>
>
>



Re: Copy records, change date, save new... by cccrash

cccrash
Thu May 24 11:10:01 CDT 2007

Thanks Patrice, I will take a look at that and see if I can make heads for
tails from it.


"Patrice" wrote:

> To match columns it would be rather :
>
> INSERT INTO t(a,b,c,d) SELECT a,'Some new value',c,d FROM t WHERE a='xxx'
>
> (changed b,c by c,d at the end of the select statement,'Some new value'
> being the replacement for the b coluumn. The literal string delimiter may
> also vary as I'm using Access quite rarely, utse the usual string delimited
> used by Access...)
>
> "Patrice" <http://www.chez.com/scribe/> a écrit dans le message de news:
> Okn5EshnHHA.1904@TK2MSFTNGP02.phx.gbl...
> > See the INSERT INTO statement
> > (http://www.blueclaw-db.com/accessquerysql/sql_insert_into.htm).
> >
> > Basiclaly it could be somehting like :
> >
> > INSERT INTO t(a,b,c,d) SELECT a,'Some new value',b,c FROM t WHERE a='xxx'
> >
> >
> > "cc_crash" <cccrash@discussions.microsoft.com> a écrit dans le message de
> > news: 54BC9DBF-F82E-46CD-96AD-ED8AB04A11BF@microsoft.com...
> >>I am working with VB.Net 2005 going to an Access 2003 database.
> >>
> >> I want to give my user the ability to copy a list of Orders (based on MR
> >> #
> >> and PreviousVisitDate) to a new VisitDate when they are creating one. I
> >> have
> >> everything ready but I am stuck on how to construct an SQL statement to
> >> do
> >> what I need to do. So this is what I have to do..
> >>
> >> 1. Select all Orders with the specified MR and PreviousVisitDate
> >>
> >> 2. Copy all of the returned records (to a new temp table??)
> >>
> >> 3. Change the Date in the returned records to the New Date they entered.
> >>
> >> So now I will have the original list and the new list that looks just
> >> like
> >> it but with a different Date.
> >>
> >> I am sure this is simple for most of you but I am struggling with it. Can
> >> anyone show me an example of how this would be done or point me to one
> >> that I
> >> can read through? Thanks for any help you can give me with this.
> >>
> >
> >
>
>
>