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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |