A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"On Current" Event based on subform data



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2006, 01:10 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default "On Current" Event based on subform data

Hi all,

I'm trying to control a form's text boxes (whether they are enabled or not)
based on the value of a field in a subform.

I have it designed so you can have many records in the main form which
relate to one record in the subform.

I have tried using SQL in the main form (SELECT CEP FROM tb_Frame_Download)
to no avail - I keep getting '#NAME?'

I am absolutely tearing my hair out over this, could anyone please help?!!

Many Thanks,
Phil


PS -

Also as for redesigning the schema, I'm afraid there simply isn't a way
round it - I have to have this many to one relationship.

And it is essential I grey out these boxes or else it will comprise data
quality in that only certain combinations of values are allowed.


  #2  
Old February 24th, 2006, 01:16 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default "On Current" Event based on subform data

Pretty hard to give advice without seeing the actual code that's failing.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
Hi all,

I'm trying to control a form's text boxes (whether they are enabled or

not)
based on the value of a field in a subform.

I have it designed so you can have many records in the main form which
relate to one record in the subform.

I have tried using SQL in the main form (SELECT CEP FROM

tb_Frame_Download)
to no avail - I keep getting '#NAME?'

I am absolutely tearing my hair out over this, could anyone please help?!!

Many Thanks,
Phil


PS -

Also as for redesigning the schema, I'm afraid there simply isn't a way
round it - I have to have this many to one relationship.

And it is essential I grey out these boxes or else it will comprise data
quality in that only certain combinations of values are allowed.




  #3  
Old February 24th, 2006, 01:48 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default "On Current" Event based on subform data

I know this doesn't work, but this is what I am trying to achieve.

Private Sub Form_Current()

If SELECT CEP FROM tb_Frame_Download = "ALOP" Then 'this being the subform
ALOP.Enabled = True
Else
ALOP.Enabled = False
End If

End Sub


"Douglas J Steele" wrote:

Pretty hard to give advice without seeing the actual code that's failing.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
Hi all,

I'm trying to control a form's text boxes (whether they are enabled or

not)
based on the value of a field in a subform.

I have it designed so you can have many records in the main form which
relate to one record in the subform.

I have tried using SQL in the main form (SELECT CEP FROM

tb_Frame_Download)
to no avail - I keep getting '#NAME?'

I am absolutely tearing my hair out over this, could anyone please help?!!

Many Thanks,
Phil


PS -

Also as for redesigning the schema, I'm afraid there simply isn't a way
round it - I have to have this many to one relationship.

And it is essential I grey out these boxes or else it will comprise data
quality in that only certain combinations of values are allowed.





  #4  
Old February 24th, 2006, 04:28 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default "On Current" Event based on subform data

You can't use SQL in VBA like that.

Does tb_Frame_Download only contain a single row? If so, try:

If Nz(DLookup("CEP", "tb_Frame_Download"), "") = "ALOP" Then
ALOP.Enabled = True
Else
ALOP.Enabled = False
End If

or

ALOP.Enabled = (Nz(DLookup("CEP", "tb_Frame_Download"), "") = "ALOP")

If tb_Frame_Download has more than one row, are you simply interested in
whether any row has ALOP in it, or do you need to look for the value of CEP
for a specific row?


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
I know this doesn't work, but this is what I am trying to achieve.

Private Sub Form_Current()

If SELECT CEP FROM tb_Frame_Download = "ALOP" Then 'this being the subform
ALOP.Enabled = True
Else
ALOP.Enabled = False
End If

End Sub


"Douglas J Steele" wrote:

Pretty hard to give advice without seeing the actual code that's

failing.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
Hi all,

I'm trying to control a form's text boxes (whether they are enabled or

not)
based on the value of a field in a subform.

I have it designed so you can have many records in the main form which
relate to one record in the subform.

I have tried using SQL in the main form (SELECT CEP FROM

tb_Frame_Download)
to no avail - I keep getting '#NAME?'

I am absolutely tearing my hair out over this, could anyone please

help?!!

Many Thanks,
Phil


PS -

Also as for redesigning the schema, I'm afraid there simply isn't a

way
round it - I have to have this many to one relationship.

And it is essential I grey out these boxes or else it will comprise

data
quality in that only certain combinations of values are allowed.







  #5  
Old February 27th, 2006, 05:34 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default "On Current" Event based on subform data

Perfect!! To answer your question, Frame_Download will only every have one row.

Many thanks got your help Doug, much appreciated - the dlookup was the
breakthrough - and not at all obvious.

thanks
Phil

"Douglas J Steele" wrote:

You can't use SQL in VBA like that.

Does tb_Frame_Download only contain a single row? If so, try:

If Nz(DLookup("CEP", "tb_Frame_Download"), "") = "ALOP" Then
ALOP.Enabled = True
Else
ALOP.Enabled = False
End If

or

ALOP.Enabled = (Nz(DLookup("CEP", "tb_Frame_Download"), "") = "ALOP")

If tb_Frame_Download has more than one row, are you simply interested in
whether any row has ALOP in it, or do you need to look for the value of CEP
for a specific row?


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
I know this doesn't work, but this is what I am trying to achieve.

Private Sub Form_Current()

If SELECT CEP FROM tb_Frame_Download = "ALOP" Then 'this being the subform
ALOP.Enabled = True
Else
ALOP.Enabled = False
End If

End Sub


"Douglas J Steele" wrote:

Pretty hard to give advice without seeing the actual code that's

failing.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Phil Davy" wrote in message
...
Hi all,

I'm trying to control a form's text boxes (whether they are enabled or
not)
based on the value of a field in a subform.

I have it designed so you can have many records in the main form which
relate to one record in the subform.

I have tried using SQL in the main form (SELECT CEP FROM
tb_Frame_Download)
to no avail - I keep getting '#NAME?'

I am absolutely tearing my hair out over this, could anyone please

help?!!

Many Thanks,
Phil


PS -

Also as for redesigning the schema, I'm afraid there simply isn't a

way
round it - I have to have this many to one relationship.

And it is essential I grey out these boxes or else it will comprise

data
quality in that only certain combinations of values are allowed.








 




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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro to Copy & Paste [email protected] Worksheet Functions 0 December 1st, 2005 01:56 PM
PST file has reached maximum size Jeff C General Discussion 2 October 6th, 2005 01:35 PM
strategy for data entry in multiple tables LAF Using Forms 18 April 25th, 2005 04:04 AM
subform data entry judy jones via AccessMonster.com Using Forms 9 March 1st, 2005 06:26 AM
SQL view of messed up action queries Kendra Running & Setting Up Queries 2 August 31st, 2004 09:53 PM


All times are GMT +1. The time now is 05:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.