dbTalk Databases Forums  

Assignment Question

comp.databases.ms-access comp.databases.ms-access


Discuss Assignment Question in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Charles Hottel
 
Posts: n/a

Default Assignment Question - 03-02-2011 , 04:56 PM






I am looking at some code written by someone else and I find it strange
looking and confusing. It looks like an assignment coded in reverse.

The statement is:

Mid$(gstrUserRoot, 27,7) = gstrUserId

How should this be interpreted? Thanks.

Reply With Quote
  #2  
Old   
imb
 
Posts: n/a

Default Re: Assignment Question - 03-02-2011 , 05:26 PM






On Mar 2, 11:56*pm, "Charles Hottel" <chot... (AT) earthlink (DOT) net> wrote:
Quote:
I am looking at some code written by someone else and I find it strange
looking and confusing. *It looks like an assignment coded in reverse.

The statement is:

Mid$(gstrUserRoot, 27,7) = gstrUserId

How should this be interpreted? *Thanks.
Hi Charles,

It is the Mid statement, in which you can replace the specified
characters by another value.

Imb.

Reply With Quote
  #3  
Old   
Charles Hottel
 
Posts: n/a

Default Re: Assignment Question - 03-02-2011 , 09:43 PM



"imb" <imb4u (AT) onsmail (DOT) nl> wrote

On Mar 2, 11:56 pm, "Charles Hottel" <chot... (AT) earthlink (DOT) net> wrote:
Quote:
I am looking at some code written by someone else and I find it strange
looking and confusing. It looks like an assignment coded in reverse.

The statement is:

Mid$(gstrUserRoot, 27,7) = gstrUserId

How should this be interpreted? Thanks.

Hi Charles,

It is the Mid statement, in which you can replace the specified
characters by another value.

Imb.
Thanks, but I did know that. Perhaps I can make my question clearer. This
appears to be assiging the value of a variable to a function, but that makes
no sense to me, so I assume that the statement above is equivalent to:

gstrUserId = Mid$(gstrUserRoot, 27,7) which assigns the value of a
function to a variable.

Is that correct? I did not know that the first syntax was legal.

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: Assignment Question - 03-02-2011 , 10:14 PM



Charles Hottel wrote:

Quote:
"imb" <imb4u (AT) onsmail (DOT) nl> wrote in message
news:7a31fda8-97cb-4b93-9866-153f2ff4e47e (AT) u6g2000vbh (DOT) googlegroups.com...
On Mar 2, 11:56 pm, "Charles Hottel" <chot... (AT) earthlink (DOT) net> wrote:

I am looking at some code written by someone else and I find it strange
looking and confusing. It looks like an assignment coded in reverse.

The statement is:

Mid$(gstrUserRoot, 27,7) = gstrUserId

How should this be interpreted? Thanks.


Hi Charles,

It is the Mid statement, in which you can replace the specified
characters by another value.

Imb.


Thanks, but I did know that. Perhaps I can make my question clearer. This
appears to be assiging the value of a variable to a function, but that makes
no sense to me, so I assume that the statement above is equivalent to:

gstrUserId = Mid$(gstrUserRoot, 27,7) which assigns the value of a
function to a variable.

Is that correct? I did not know that the first syntax was legal.


var = "Help Me"
mid(var,4,4) = "l No"
? var
Hell No

It may not be used much (I never have) but it works.

Reply With Quote
  #5  
Old   
Access Developer
 
Posts: n/a

Default Re: Assignment Question - 03-02-2011 , 10:22 PM



No, the original statement, Mid$(gstrUserRoot, 27,7) = gstrUserId, replaces
the 27th and 6 following characters of the string gstrUserRoot with the
value contained in the string gstrUserID.

Mid (and Mid$) is the name of both a function which extracts data and a
statement which indicates where to save data.

A little sample code and the Immediate Window are your friends in cases like
this.

Larry Linson
Microsoft Office Access MVP

"Charles Hottel" <chottel (AT) earthlink (DOT) net> wrote

Quote:
"imb" <imb4u (AT) onsmail (DOT) nl> wrote in message
news:7a31fda8-97cb-4b93-9866-153f2ff4e47e (AT) u6g2000vbh (DOT) googlegroups.com...
On Mar 2, 11:56 pm, "Charles Hottel" <chot... (AT) earthlink (DOT) net> wrote:
I am looking at some code written by someone else and I find it strange
looking and confusing. It looks like an assignment coded in reverse.

The statement is:

Mid$(gstrUserRoot, 27,7) = gstrUserId

How should this be interpreted? Thanks.

Hi Charles,

It is the Mid statement, in which you can replace the specified
characters by another value.

Imb.

Thanks, but I did know that. Perhaps I can make my question clearer.
This appears to be assiging the value of a variable to a function, but
that makes no sense to me, so I assume that the statement above is
equivalent to:

gstrUserId = Mid$(gstrUserRoot, 27,7) which assigns the value of a
function to a variable.

Is that correct? I did not know that the first syntax was legal.


Reply With Quote
  #6  
Old   
Charles Hottel
 
Posts: n/a

Default Re: Assignment Question - 03-03-2011 , 02:25 PM



Thanks to all who answered.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.