PlasticMonster
Registered User.
- Local time
- Today, 15:56
- Joined
- Aug 21, 2012
- Messages
- 30
Im struggling again so once more return for advice, Ive been trying a few random work arounds but im sure my basic approach is askew.
I have a combobox that selects the reason for access [CBreason] when the slection is "Incident" I want the user to input an Incident Number in the[IncidentNo] textbox.
This incident number should be like "INC0001234567". The box becomes visible (and is a shiny red colour).
This is the code that I am currently using its set for the After Update event of [CBreason]:
If Me.CBReason.Column(1) = "Incident" Then
Me.IncidentNo.Visible = True
'On Error Resume Next
Me.IncidentNo.Value = Me.IncidentNo.DefaultValue
Me.IncidentNo.SetFocus
'On Error GoTo 0
Else
Me.IncidentNo.Visible = False
Me.IncidentNo.Value = "INC0000000000"
End If
I dont want the database to have blank entries so if its not needed it reads INC0000000000. I have set a mask up on the form for [IncidentNo] and set the data validation at table level to no zero entries.
Problems with this 'solution' are:
1. I get an error when I return the box to the default value "" as no zero entries are allowed. (You can see I tried to add in on error resume next to get past this but its not really working).
2. If the user changes their mind selecting first "incident", then something else, then "incident" again the [IncidentNo] reads INC0000000000 and they can just use this and progress without out giving their one!!
This is abit of a garbled post but I think staring at the computer all day has melted my brain a little bit.
Please suggest where I am going wrong, im pretty sure setting validation on both the form and the table is a bad idea to begin with, but was my best idea so far....Umm
Help... Please....
I have a combobox that selects the reason for access [CBreason] when the slection is "Incident" I want the user to input an Incident Number in the[IncidentNo] textbox.
This incident number should be like "INC0001234567". The box becomes visible (and is a shiny red colour).
This is the code that I am currently using its set for the After Update event of [CBreason]:
If Me.CBReason.Column(1) = "Incident" Then
Me.IncidentNo.Visible = True
'On Error Resume Next
Me.IncidentNo.Value = Me.IncidentNo.DefaultValue
Me.IncidentNo.SetFocus
'On Error GoTo 0
Else
Me.IncidentNo.Visible = False
Me.IncidentNo.Value = "INC0000000000"
End If
I dont want the database to have blank entries so if its not needed it reads INC0000000000. I have set a mask up on the form for [IncidentNo] and set the data validation at table level to no zero entries.
Problems with this 'solution' are:
1. I get an error when I return the box to the default value "" as no zero entries are allowed. (You can see I tried to add in on error resume next to get past this but its not really working).
2. If the user changes their mind selecting first "incident", then something else, then "incident" again the [IncidentNo] reads INC0000000000 and they can just use this and progress without out giving their one!!
This is abit of a garbled post but I think staring at the computer all day has melted my brain a little bit.
Please suggest where I am going wrong, im pretty sure setting validation on both the form and the table is a bad idea to begin with, but was my best idea so far....Umm
Help... Please....
