From: Linda RQ on 30 Mar 2010 12:30 Hi Everyone, Using Access 2003. I have a patient database. I will try to explain as best I can but I don't know the object names etc very well so let me know what else I need to give if the info makes no sense. I have a subform of patient therapy that shows on a main form. There are several fields with therapy detail on my subform that get filled out when a therapy is started. When the therapy is ended, the end date field is filled in. I need to lock one field (therapy type) once a therapy is selected. The therapy type field is a combobox with a list to select from. I tried going into the form properties and locking the record and not allowing edits but then I couldn't enter an end date later. I tried going into the control for therapy type and locking that which worked but then I coudn't add therapy type to a new record. Is there anyway without vb code that I can prevent the user from changing just that item once it has been entered? Thanks, Linda
From: Daryl S on 30 Mar 2010 14:12 Linda - Try something like this in the OnCurrent event for the form (use your control name for cboName): If me.cboName.column(0) is null then Me.cboName.enabled = True Else Me.cboName.enabled = False End If -- Daryl S "Linda RQ" wrote: > Hi Everyone, > > Using Access 2003. I have a patient database. I will try to explain as > best I can but I don't know the object names etc very well so let me know > what else I need to give if the info makes no sense. I have a subform of > patient therapy that shows on a main form. There are several fields with > therapy detail on my subform that get filled out when a therapy is started. > When the therapy is ended, the end date field is filled in. I need to lock > one field (therapy type) once a therapy is selected. The therapy type field > is a combobox with a list to select from. I tried going into the form > properties and locking the record and not allowing edits but then I couldn't > enter an end date later. I tried going into the control for therapy type > and locking that which worked but then I coudn't add therapy type to a new > record. > > Is there anyway without vb code that I can prevent the user from changing > just that item once it has been entered? > > Thanks, > Linda > > > . >
From: Linda RQ on 30 Mar 2010 20:53 Thanks Daryl...but I said no VB code puleeze...but ok, I'll try <g>. I can sort of see what that is saying. This is what I did. I clicked in the corner of the subform in the design view of the form and pulled up the properties. I clicked in the OnCurrent event and went into build and pasted your code. I compiled then saved. When I opened up the form in form view I got a debug error and the second line below "If Me.ThpyTypeID_fk.Column(0) Is Null Then" is highlighted in yellow. Private Sub Form_Current() If Me.ThpyTypeID_fk.Column(0) Is Null Then Me.ThpyTypeID_fk.Enabled = True Else Me.ThpyTypeID_fk.Enabled = False End If End Sub "Daryl S" <DarylS(a)discussions.microsoft.com> wrote in message news:5EF7638F-857D-4188-9507-0412B2BB84ED(a)microsoft.com... > Linda - > > Try something like this in the OnCurrent event for the form (use your > control name for cboName): > > If me.cboName.column(0) is null then > Me.cboName.enabled = True > Else > Me.cboName.enabled = False > End If > > -- > Daryl S > > > "Linda RQ" wrote: > >> Hi Everyone, >> >> Using Access 2003. I have a patient database. I will try to explain as >> best I can but I don't know the object names etc very well so let me know >> what else I need to give if the info makes no sense. I have a subform of >> patient therapy that shows on a main form. There are several fields >> with >> therapy detail on my subform that get filled out when a therapy is >> started. >> When the therapy is ended, the end date field is filled in. I need to >> lock >> one field (therapy type) once a therapy is selected. The therapy type >> field >> is a combobox with a list to select from. I tried going into the form >> properties and locking the record and not allowing edits but then I >> couldn't >> enter an end date later. I tried going into the control for therapy type >> and locking that which worked but then I coudn't add therapy type to a >> new >> record. >> >> Is there anyway without vb code that I can prevent the user from changing >> just that item once it has been entered? >> >> Thanks, >> Linda >> >> >> . >>
From: Rob Parker on 30 Mar 2010 21:13 Hi Linda, The syntax is wrong; the line should be: .... If IsNull(Me.ThpyTypeID_fk.Column(0)) Then .... HTH, Rob Linda RQ wrote: > Thanks Daryl...but I said no VB code puleeze...but ok, I'll try <g>. I can > sort of see what that is saying. This is what I did. I > clicked in the corner of the subform in the design view of the form > and pulled up the properties. I clicked in the OnCurrent event and > went into build and pasted your code. I compiled then saved. When I > opened up the form in form view I got a debug error and the second > line below "If Me.ThpyTypeID_fk.Column(0) Is Null Then" is > highlighted in yellow. > Private Sub Form_Current() > If Me.ThpyTypeID_fk.Column(0) Is Null Then > Me.ThpyTypeID_fk.Enabled = True > Else > Me.ThpyTypeID_fk.Enabled = False > End If > End Sub > > > > "Daryl S" <DarylS(a)discussions.microsoft.com> wrote in message > news:5EF7638F-857D-4188-9507-0412B2BB84ED(a)microsoft.com... >> Linda - >> >> Try something like this in the OnCurrent event for the form (use your >> control name for cboName): >> >> If me.cboName.column(0) is null then >> Me.cboName.enabled = True >> Else >> Me.cboName.enabled = False >> End If >> >> -- >> Daryl S >> >> >> "Linda RQ" wrote: >> >>> Hi Everyone, >>> >>> Using Access 2003. I have a patient database. I will try to >>> explain as best I can but I don't know the object names etc very >>> well so let me know what else I need to give if the info makes no >>> sense. I have a subform of patient therapy that shows on a main >>> form. There are several fields with >>> therapy detail on my subform that get filled out when a therapy is >>> started. >>> When the therapy is ended, the end date field is filled in. I need >>> to lock >>> one field (therapy type) once a therapy is selected. The therapy >>> type field >>> is a combobox with a list to select from. I tried going into the >>> form properties and locking the record and not allowing edits but >>> then I couldn't >>> enter an end date later. I tried going into the control for >>> therapy type and locking that which worked but then I coudn't add >>> therapy type to a new >>> record. >>> >>> Is there anyway without vb code that I can prevent the user from >>> changing just that item once it has been entered? >>> >>> Thanks, >>> Linda >>> >>> >>> .
From: Daryl S on 31 Mar 2010 09:42 Thanks Rob - I guess I've been doing too much SQL lately! -- Daryl S "Rob Parker" wrote: > Hi Linda, > > The syntax is wrong; the line should be: > .... > If IsNull(Me.ThpyTypeID_fk.Column(0)) Then > .... > > HTH, > > Rob > > > Linda RQ wrote: > > Thanks Daryl...but I said no VB code puleeze...but ok, I'll try <g>. I can > > sort of see what that is saying. This is what I did. I > > clicked in the corner of the subform in the design view of the form > > and pulled up the properties. I clicked in the OnCurrent event and > > went into build and pasted your code. I compiled then saved. When I > > opened up the form in form view I got a debug error and the second > > line below "If Me.ThpyTypeID_fk.Column(0) Is Null Then" is > > highlighted in yellow. > > Private Sub Form_Current() > > If Me.ThpyTypeID_fk.Column(0) Is Null Then > > Me.ThpyTypeID_fk.Enabled = True > > Else > > Me.ThpyTypeID_fk.Enabled = False > > End If > > End Sub > > > > > > > > "Daryl S" <DarylS(a)discussions.microsoft.com> wrote in message > > news:5EF7638F-857D-4188-9507-0412B2BB84ED(a)microsoft.com... > >> Linda - > >> > >> Try something like this in the OnCurrent event for the form (use your > >> control name for cboName): > >> > >> If me.cboName.column(0) is null then > >> Me.cboName.enabled = True > >> Else > >> Me.cboName.enabled = False > >> End If > >> > >> -- > >> Daryl S > >> > >> > >> "Linda RQ" wrote: > >> > >>> Hi Everyone, > >>> > >>> Using Access 2003. I have a patient database. I will try to > >>> explain as best I can but I don't know the object names etc very > >>> well so let me know what else I need to give if the info makes no > >>> sense. I have a subform of patient therapy that shows on a main > >>> form. There are several fields with > >>> therapy detail on my subform that get filled out when a therapy is > >>> started. > >>> When the therapy is ended, the end date field is filled in. I need > >>> to lock > >>> one field (therapy type) once a therapy is selected. The therapy > >>> type field > >>> is a combobox with a list to select from. I tried going into the > >>> form properties and locking the record and not allowing edits but > >>> then I couldn't > >>> enter an end date later. I tried going into the control for > >>> therapy type and locking that which worked but then I coudn't add > >>> therapy type to a new > >>> record. > >>> > >>> Is there anyway without vb code that I can prevent the user from > >>> changing just that item once it has been entered? > >>> > >>> Thanks, > >>> Linda > >>> > >>> > >>> . > > > . >
|
Next
|
Last
Pages: 1 2 Prev: Calculated fields on a form Next: Problems filtering recordset with combobox |