Hi Shreekant,
It seems you already have the basic framework you need. How
about something like this:
'~~~~~~~~~~~~~~~~~~~~~~
Private Sub cboEllipseAssetType_AfterUpdate()
dim mBoo as boolean
Select Case Me.cboEllipseAssetType
Case "Access Gantry"
mBoo = False
Me
'you will need to finish the above line
'after you paste, type a period after Me
'so you are prompted with the controlnames
'put statement in this form:
'me.controlname = Null
Case Else
mBoo = true
End Select
Me.cboRoomCodeDescription.Enabled = mBoo
Me.chkBoundaryWall.Enabled = mBoo
'you should not use ( ) in your names
'Me.txtHeadroom(Signed).Enabled = mBoo
'rename you control
Me.txtHeadroom_Signed.Enabled = mBoo
Me.txtDepth.Enabled = mBoo
Me.txtDiameter.Enabled = mBoo
End Sub
'~~~~~~~~~~~~~~~~~~~~~~
it is better to use Me. than Me! while you are coding so
that you can be prompted with acceptable choices. Try using
this when you code -- perhaps you are not using the correct
controlnames.
'~~~~~~~~~~~~~~~~~~~~~~
You should have an AssetTypes table that looks something
like this:
*AssetTypes*
ATypeID, autonumber
AssetType, text
In related tables, you chould have
ATypeID, long integer, defaultValue =Null
(set default value if not all records will be filled out so
that you can enforce referential integrity)
do NOT make this a lookup control in the table design --
that is done in forms with comboboxes
'~~~~~~~~~~~~~~~~~~~~~~
on your form, here is an example with the properties you
need to set for a combobox that stored the ID and displays
the text
combobox control
Name --> ATypeID
ControlSource --> ATypeID
RowSource -->
SELECT ATypeID, AssetType
FROM AssetTypes
ORDER BY AssetType
BoundColumn --> 1
ColumnCount --> 2
columnWidths --> 0;2
(etc for however many columns you have
-- the ID column will be hidden since its width is zero)
ListWidth --> 2
(should add up to the sum of the column widths)
ATypeID will be stored in the form RecordSource while
showing you information from another table...
'~~~~~~~~~~~~~~~~~~~~~~
In the code, you will test the numeric ATypeID, not the text
AssetType value.
'~~~~~~~~~~~~~~~~~~~~~~
If Ellipse was a descrptive for AssetType, add another field
to the AssetTypes table with category. If you have repeated
categories, you may need a Categories table with CatID.
Warm Regards,
Crystal
Microsoft Access MVP 2006
*
Have an awesome day
remote programming and training
strive4peace2006 at yahoo.com
*
Hi Crystal,
Thank you for your earlier post. I think I should have given you more
information.
I have two requirements,
1. When an item is selected from the cboEllipseAssetType, certain text
boxes have to be greyed out so that users cannot enter any data.
2. From the same combo box, cboEllipseAssetType, I also require what I
mentioned above that certain text boxes should default to NA.
This is the current code I have implemented on the after update for the
text boxes to be greyed out.
Private Sub cboEllipseAssetType_AfterUpdate()
Select Case Me.cboEllipseAssetType
Case "Access Gantry"
Me![cboRoomCodeDescription].Enabled = False
Me![chkBoundaryWall].Enabled = False
Me![txtHeadroom(Signed)].Enabled = False
Me![txtDepth].Enabled = False
Me![txtDiameter].Enabled = False
Case Else
Me![cboRoomCodeDescription].Enabled = True
Me![chkBoundaryWall].Enabled = True
Me![txtHeadroom(Signed)].Enabled = True
Me![txtDepth].Enabled = True
Me![txtDiameter].Enabled = True
End Select
End Sub
I tried implemented your method on top of this but I was not very
successful.
I apologise for not being very informative on my initial post. I would
appreciate your further help possible.
Thanks
Shreekant
Keen Access Developer!