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  

This is so simple, why isn't it working???



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2005, 04:07 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default This is so simple, why isn't it working???

hello all,
I know it's something stupid I'm overlooking somewhere...
I have a main form frm_PBT with many text fields and comboboxes on it.
If a record comes up with cmbGroup,cmbCompany,cmbYear or cmbPeriod already
populated I wanted those fields to be disabled...

Small sample:

Private Sub Form_Current()
If Me.cmbGroup.Value = True Then
Me.cmbGroup.Enabled = False
Else: Me.cmbGroup.Enabled = True

End If

End Sub

What I'm expecting to happen is when the form opens or the record changes
the field should be disabled.... am I wrong? Nothing happens.
Can someone help?
  #2  
Old December 15th, 2005, 04:14 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default This is so simple, why isn't it working???

"TimT" wrote in message

hello all,
I know it's something stupid I'm overlooking somewhere...
I have a main form frm_PBT with many text fields and comboboxes on it.
If a record comes up with cmbGroup,cmbCompany,cmbYear or cmbPeriod
already populated I wanted those fields to be disabled...

Small sample:

Private Sub Form_Current()
If Me.cmbGroup.Value = True Then
Me.cmbGroup.Enabled = False
Else: Me.cmbGroup.Enabled = True

End If

End Sub

What I'm expecting to happen is when the form opens or the record
changes the field should be disabled.... am I wrong? Nothing
happens.
Can someone help?


Is cmbGroup bound to a Yes/No field? If not, it's fairly unlikely that
its value will be equal to True. Maybe what you want is this:

If IsNull(Me.cmbGroup.Value) Then
Me.cmbGroup.Enabled = True
Else
Me.cmbGroup.Enabled = False
End If

.... which could be simplified to this:

With Me.cmbGroup
.Enabled = IsNull(.Value)
End With


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old December 15th, 2005, 04:15 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default This is so simple, why isn't it working???

Try this instead:

If IsNull(Me.cmbGroup) Then
Me.cmbGroup.Enabled = True
Else
Me.cmbGroup.Enabled = False
End If

  #4  
Old December 15th, 2005, 04:26 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default This is so simple, why isn't it working???

Well, the value is not true. The value is whatever is entered in the field.

You'd want to say, if the value is not null or if it is not "".

--
Rick B



"TimT" wrote in message
...
hello all,
I know it's something stupid I'm overlooking somewhere...
I have a main form frm_PBT with many text fields and comboboxes on it.
If a record comes up with cmbGroup,cmbCompany,cmbYear or cmbPeriod already
populated I wanted those fields to be disabled...

Small sample:

Private Sub Form_Current()
If Me.cmbGroup.Value = True Then
Me.cmbGroup.Enabled = False
Else: Me.cmbGroup.Enabled = True

End If

End Sub

What I'm expecting to happen is when the form opens or the record changes
the field should be disabled.... am I wrong? Nothing happens.
Can someone help?



 




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
Simple database with a simple form j0ker21m Using Forms 1 December 7th, 2005 05:53 PM
simple record search (or perhaps not so simple) Greg General Discussion 13 November 21st, 2005 03:01 AM
This should be simple but it's not working for me! hellokitty New Users 4 April 12th, 2005 01:26 AM
How to Do Simple Vector Based Graphics Using MS-Access? Jay Chan General Discussion 2 September 1st, 2004 04:29 PM
Simple Query Not Working Michael DiCostanzo Running & Setting Up Queries 2 June 23rd, 2004 11:37 PM


All times are GMT +1. The time now is 09:11 AM.


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