dbTalk Databases Forums  

One last issue in DB: Can't update text

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


Discuss One last issue in DB: Can't update text in the comp.databases.ms-access forum.



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

Default One last issue in DB: Can't update text - 03-18-2009 , 11:56 AM






Sorry to bug the list so much, I've got one last issue I can't work
out, and my brain is fried (by the time this is done, my queries will
likely be pulling over 12,000,000 records and I'm on brain drain mode
right now).

I've finally got all three combo boxes in my last post synchronized
(long story short: I'm using three combo boxes to drill down deeper
and deeper through a SQL query joining three tables, successively
going down through Server Name, then Share Name, then the individual
user - resulting in a text box populated with that user's access
rights to that share on that server). My problem now is that when I
select an entry on the last combo box (user name), and the After
Update event procedure is triggered, I get the following error:

Run-time error '2115':

The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field.

There are no BeforeUpdate conditions or ValidationRule conditions set
on any of my controls, so I'm not sure why it's throwing this. Here's
the event procedure I'm doing on the final combo box After Update:

Private Sub cmbTrusteeUser_AfterUpdate()
Me.txtPermissions.SetFocus
Me.txtPermissions.Text = "SELECT Access FROM" & _
" tblSharePermissions WHERE Server_Name
= """ & _
Me.cmbServerName & _
""" AND Share_Name = """ & _
Me.cmbShareName & _
""" AND TrusteeDomain_Name = """ & _
Me.cmbTrusteeUser
End Sub

*I noted the mismatch in naming conventions between the table column
TrusteeDomain_Name and my cmbTrusteeUser, it's on my list of things to
remediate but I don't think it's causing the error.

Could this be something in the formatting of the fields in the
database tables? The field TrusteeDomain_Name has a slash in it (for
example, "MICROSOFT\BGates001", without quotes). I've tried changing
the assignment to Me.txtPermissions.Value , but then it just puts my
query statement in there.

Thanks

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

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 12:06 PM






If you want the *result* of the query to appear in txtPermissions, rather
than the SQL statement, then you are going about it the wrong way.

Simplest approach is this:

txtPermissions = Dlookup( _
"Access", _
" tblSharePermissions", _
"Server_Name = """ & _
Me.cmbServerName & _
""" AND Share_Name = """ & _
Me.cmbShareName & _
""" AND TrusteeDomain_Name =
""" & _
Me.cmbTrusteeUser)

n.b. it's rarely necessary to use the Text property of a text box because,
as you have obviously discovered, you are forced to give it the focus first.
You can simply assign a value as I have shown above.


"chickenfriedsteak" <owner (AT) chickenfriedsteak (DOT) us> wrote

Quote:
Sorry to bug the list so much, I've got one last issue I can't work
out, and my brain is fried (by the time this is done, my queries will
likely be pulling over 12,000,000 records and I'm on brain drain mode
right now).

I've finally got all three combo boxes in my last post synchronized
(long story short: I'm using three combo boxes to drill down deeper
and deeper through a SQL query joining three tables, successively
going down through Server Name, then Share Name, then the individual
user - resulting in a text box populated with that user's access
rights to that share on that server). My problem now is that when I
select an entry on the last combo box (user name), and the After
Update event procedure is triggered, I get the following error:

Run-time error '2115':

The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field.

There are no BeforeUpdate conditions or ValidationRule conditions set
on any of my controls, so I'm not sure why it's throwing this. Here's
the event procedure I'm doing on the final combo box After Update:

Private Sub cmbTrusteeUser_AfterUpdate()
Me.txtPermissions.SetFocus
Me.txtPermissions.Text = "SELECT Access FROM" & _
" tblSharePermissions WHERE Server_Name
= """ & _
Me.cmbServerName & _
""" AND Share_Name = """ & _
Me.cmbShareName & _
""" AND TrusteeDomain_Name = """ & _
Me.cmbTrusteeUser
End Sub

*I noted the mismatch in naming conventions between the table column
TrusteeDomain_Name and my cmbTrusteeUser, it's on my list of things to
remediate but I don't think it's causing the error.

Could this be something in the formatting of the fields in the
database tables? The field TrusteeDomain_Name has a slash in it (for
example, "MICROSOFT\BGates001", without quotes). I've tried changing
the assignment to Me.txtPermissions.Value , but then it just puts my
query statement in there.

Thanks



Reply With Quote
  #3  
Old   
chickenfriedsteak
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 12:54 PM



On Mar 18, 2:06*pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:
Quote:
If you want the *result* of the query to appear in txtPermissions, rather
than the SQL statement, then you are going about it the wrong way.

Simplest approach is this:

*txtPermissions = Dlookup( _
* * * * * * * * * * * * * * * * * * * * "Access", _
* * * * * * * * * * * * * * * * * * * * " tblSharePermissions", _
* * * * * * * * * * * * * * * * * * * * "Server_Name = """ & _
* * * * * * * * * * * * * * * * * * * * * * * * Me.cmbServerName & _
* * * * * * * * * * * * * * * * * * * * * * * * """ AND Share_Name = """ & _
* * * * * * * * * * * * * * * * * * * * * * * * Me.cmbShareName & _
* * * * * * * * * * * * * * * * * * * * * * * * """ AND TrusteeDomain_Name =
""" & _
* * * * * * * * * * * * * * * * * * * * * * * * Me.cmbTrusteeUser)

n.b. it's rarely necessary to use the Text property of a text box because,
as you have obviously discovered, you are forced to give it the focus first.
You can simply assign a value as I have shown above.

"chickenfriedsteak" <ow... (AT) chickenfriedsteak (DOT) us> wrote in message

news:a03ee7a0-e529-4e4f-9bd2-6d9096a41079 (AT) b16g2000yqb (DOT) googlegroups.com...



Sorry to bug the list so much, I've got one last issue I can't work
out, and my brain is fried (by the time this is done, my queries will
likely be pulling over 12,000,000 records and I'm on brain drain mode
right now).

I've finally got all three combo boxes in my last post synchronized
(long story short: I'm using three combo boxes to drill down deeper
and deeper through a SQL query joining three tables, successively
going down through Server Name, then Share Name, then the individual
user - resulting in a text box populated with that user's access
rights to that share on that server). *My problem now is that when I
select an entry on the last combo box (user name), and the After
Update event procedure is triggered, I get the following error:

Run-time error '2115':

The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing Microsoft Office Access from
saving the data in the field.

There are no BeforeUpdate conditions or ValidationRule conditions set
on any of my controls, so I'm not sure why it's throwing this. *Here's
the event procedure I'm doing on the final combo box After Update:

Private Sub cmbTrusteeUser_AfterUpdate()
* *Me.txtPermissions.SetFocus
* *Me.txtPermissions.Text = "SELECT Access FROM" & _
* * * * * * * * * * * * * * * " tblSharePermissions WHERE Server_Name
= """ & _
* * * * * * * * * * * * * * * Me.cmbServerName & _
* * * * * * * * * * * * * * * """ AND Share_Name = """ & _
* * * * * * * * * * * * * * * Me.cmbShareName & _
* * * * * * * * * * * * * * * """ AND TrusteeDomain_Name = """ & _
* * * * * * * * * * * * * * * Me.cmbTrusteeUser
End Sub

*I noted the mismatch in naming conventions between the table column
TrusteeDomain_Name and my cmbTrusteeUser, it's on my list of things to
remediate but I don't think it's causing the error.

Could this be something in the formatting of the fields in the
database tables? *The field TrusteeDomain_Name has a slash in it (for
example, "MICROSOFT\BGates001", without quotes). *I've tried changing
the assignment to Me.txtPermissions.Value , but then it just puts my
query statement in there.

Thanks- Hide quoted text -

- Show quoted text -
I'm getting error "Expected: expression" at the first & _ line carry-
over in the code you provided. Since it started bombing out, rather
than save it in my production DB, I'm back in my test one until I can
fully grasp the concept (I've never used the DLookup in Access
before).

Below is a cut and paste from my test DB; same thing as above, just
with the bad names. Why are the line carry-overs throwing this
error? I've tried it without the line carries, just running it all on
one long line and I get compile error "Expected: list separator or )"
at the Me in Me.Combo11.

Private Sub Combo17_AfterUpdate()

Me.Text24 = DLookup(& _
"Access", & _
"tblSharePermissions", & _
"Server_Name = """ & _
Me.Combo11 & _
""" AND Share_Name = """ & _
Me.Combo15 & _
""" AND TrusteeDomain_Name = """ & _
Me.Combo17)

End Sub

Is there something thrown off in the quotation marks, or maybe the
line carries? Like I said, I want to make sure I fully understand the
formatting and concept before putting into my production DB.

Thanks


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

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 01:22 PM




"chickenfriedsteak" <owner (AT) chickenfriedsteak (DOT) us> wrote

On Mar 18, 2:06 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:

If you carefully compare what you've implemented to what I posted, you will
see that you've added extra ampersands (&) where you don't need them.

The ampersand is not part of a line continuation. The underscore character
alone implements a line continuation. The ampersand is the string
concatenation operator.



Reply With Quote
  #5  
Old   
chickenfriedsteak
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 01:37 PM



On Mar 18, 3:22*pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:
Quote:
"chickenfriedsteak" <ow... (AT) chickenfriedsteak (DOT) us> wrote in message

news:f0145f3d-92ba-4260-8aac-1e1ec9a9a627 (AT) v15g2000yqn (DOT) googlegroups.com...
On Mar 18, 2:06 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:

If you carefully compare what you've implemented to what I *posted, youwill
see that you've added extra ampersands (&) where you don't need them.

The ampersand is not part of a line continuation. *The underscore character
alone implements a line continuation. *The ampersand is the string
concatenation operator.
Thanks, I caught my typos on the third time I keyed it in by hand.
The Google usenet reader must shave off the spaces after the
underscores in the line continuations, because they weren't there when
I tried to copy-and-paste.

I'm getting a different error now:

Run-time error '3075':

Syntax error in string in query expression
'Server_Name="SERVER01" AND Share_Name="ADMIN$" AND
TrusteeDomain_Name="MYDOMAIN\User001'.

Once again, I don't see where my syntax is bad because from that error
it's pulling everything correctly from the combos in my test
database. I can even find that exact record in the database by hand.
Here's what I have now (hopefully without typos):

Private Sub Combo17_AfterUpdate()

Me.Text24 = DLookup( _
"Access", _
"tblSharePermissions", _
"Server_Name=""" & _
Me.Combo11 & _
""" AND Share_Name=""" & _
Me.Combo15 & _
""" AND TrusteeDomain_Name =""" & _
Me.Combo17)

End Sub


Reply With Quote
  #6  
Old   
bcap
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 01:43 PM



One of us has omitted the closing quotation marks on the last line, which
should read as follows:

Me.Combo17 & """")

n.b. yes, that really is *four* double-quote marks!

"chickenfriedsteak" <owner (AT) chickenfriedsteak (DOT) us> wrote

On Mar 18, 3:22 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:
Quote:
"chickenfriedsteak" <ow... (AT) chickenfriedsteak (DOT) us> wrote in message

news:f0145f3d-92ba-4260-8aac-1e1ec9a9a627 (AT) v15g2000yqn (DOT) googlegroups.com...
On Mar 18, 2:06 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:

If you carefully compare what you've implemented to what I posted, you
will
see that you've added extra ampersands (&) where you don't need them.

The ampersand is not part of a line continuation. The underscore character
alone implements a line continuation. The ampersand is the string
concatenation operator.
Thanks, I caught my typos on the third time I keyed it in by hand.
The Google usenet reader must shave off the spaces after the
underscores in the line continuations, because they weren't there when
I tried to copy-and-paste.

I'm getting a different error now:

Run-time error '3075':

Syntax error in string in query expression
'Server_Name="SERVER01" AND Share_Name="ADMIN$" AND
TrusteeDomain_Name="MYDOMAIN\User001'.

Once again, I don't see where my syntax is bad because from that error
it's pulling everything correctly from the combos in my test
database. I can even find that exact record in the database by hand.
Here's what I have now (hopefully without typos):

Private Sub Combo17_AfterUpdate()

Me.Text24 = DLookup( _
"Access", _
"tblSharePermissions", _
"Server_Name=""" & _
Me.Combo11 & _
""" AND Share_Name=""" & _
Me.Combo15 & _
""" AND TrusteeDomain_Name =""" & _
Me.Combo17)

End Sub




Reply With Quote
  #7  
Old   
chickenfriedsteak
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 01:57 PM



On Mar 18, 3:43*pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:
Quote:
One of us has omitted the closing quotation marks on the last line, which
should read as follows:

Me.Combo17 & """")

n.b. yes, that really is *four* double-quote marks!

(Snip)

YARGGHHH! that fixed it.

I haven't done this much hassling and cussing at quotation marks since
the last time I had to touch something in C++.


Reply With Quote
  #8  
Old   
aaron.kempf@gmail.com
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-18-2009 , 09:43 PM



dude you're a moron.

you're putting mountains of logic in queries-- where you need 100
copies of it--
instead of putting logic where it belongs-- on the database server.

Do you honestly think that Jet can handle 12m records?

ROFL good luck with that dude

I used to have a dozen 1m tables, in about 60 distinct applications
running in jet.
I hated it-- it doesn't work well enough.

Upsize to SQL Server and things just work

-Aaron




On Mar 18, 12:57*pm, chickenfriedsteak <ow... (AT) chickenfriedsteak (DOT) us>
wrote:
Quote:
On Mar 18, 3:43*pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:> One of us has omitted the closing quotation marks on the last line, which
should read as follows:

Me.Combo17 & """")

n.b. yes, that really is *four* double-quote marks!

(Snip)

YARGGHHH! *that fixed it.

I haven't done this much hassling and cussing at quotation marks since
the last time I had to touch something in C++.


Reply With Quote
  #9  
Old   
bcap
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-19-2009 , 12:25 AM




"chickenfriedsteak" <owner (AT) chickenfriedsteak (DOT) us> wrote

On Mar 18, 3:43 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:
Quote:
One of us has omitted the closing quotation marks on the last line, which
should read as follows:

Me.Combo17 & """")

n.b. yes, that really is *four* double-quote marks!

(Snip)

Quote:
YARGGHHH! that fixed it.

I haven't done this much hassling and cussing at quotation marks since
the last time I had to touch something in C++.
Yes, it's fiddly, but it becomes second nature with practice. Honestly!




Reply With Quote
  #10  
Old   
BruceM
 
Posts: n/a

Default Re: One last issue in DB: Can't update text - 03-19-2009 , 08:30 AM



Go ahead and advocate SQL server for everything down to balancing a
checkbook if you must, but stuff the name calling.

<aaron.kempf (AT) gmail (DOT) com> wrote

dude you're a moron.

you're putting mountains of logic in queries-- where you need 100
copies of it--
instead of putting logic where it belongs-- on the database server.

Do you honestly think that Jet can handle 12m records?

ROFL good luck with that dude

I used to have a dozen 1m tables, in about 60 distinct applications
running in jet.
I hated it-- it doesn't work well enough.

Upsize to SQL Server and things just work

-Aaron




On Mar 18, 12:57 pm, chickenfriedsteak <ow... (AT) chickenfriedsteak (DOT) us>
wrote:
Quote:
On Mar 18, 3:43 pm, "bcap" <b... (AT) nospam (DOT) nowhere> wrote:> One of us has
omitted the closing quotation marks on the last line, which
should read as follows:

Me.Combo17 & """")

n.b. yes, that really is *four* double-quote marks!

(Snip)

YARGGHHH! that fixed it.

I haven't done this much hassling and cussing at quotation marks since
the last time I had to touch something in C++.


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 - 2013, Jelsoft Enterprises Ltd.