Paul Cooke
Registered User.
- Local time
- Today, 15:58
- Joined
- Oct 12, 2001
- Messages
- 288
Hi all another problem which seem to be taking hours for me to work out !!
I have a combo box Called 'Name' and another called 'details'. A value must be entered in one of them but not always both of them - which is where my problem is...
If I enter a value in cboName and it is not in the list, I have a Msgbox set up...
The user clicks 'ok'.
At the moment when ok is clicked the usual default error message comes up "the text you entered isn't an item in the list"...
I have tried all methods to stop this without success.
What I need to happen is for the new entry that was typed to be undone and for the focus to be set to the next control cboDetails. What I have tried is
This is just one example of loads I have tried!
As a footnote there is also code in the lostfocus event of cboName as below but this does not seem to be causing me any problems and works fine I'm just posting it in case it may be causing a conflict,
I would be really grateful for your expert advice and help
Many thanks
I have a combo box Called 'Name' and another called 'details'. A value must be entered in one of them but not always both of them - which is where my problem is...
If I enter a value in cboName and it is not in the list, I have a Msgbox set up...
Code:
MsgResponse = MsgBox("There is no record for the Name" & vbCrLf & vbCrLf & Chr(34) & NewData & Chr(34) & _
vbCrLf & vbCrLf & "Please click ok to continue.", vbInformation + vbOKOnly, "No Record found")
The user clicks 'ok'.
At the moment when ok is clicked the usual default error message comes up "the text you entered isn't an item in the list"...
I have tried all methods to stop this without success.
What I need to happen is for the new entry that was typed to be undone and for the focus to be set to the next control cboDetails. What I have tried is
Code:
If MsgResponse = vbOK Then
If Me.Dirty Then
Me.cboName.Undo
End If
me.cboDetails.SetFocus
This is just one example of loads I have tried!
As a footnote there is also code in the lostfocus event of cboName as below but this does not seem to be causing me any problems and works fine I'm just posting it in case it may be causing a conflict,
Code:
If IsNull(Me.cboName) = True Then
Me.cboDetails.Enabled = True
Me.cboDetails.SetFocus
I would be really grateful for your expert advice and help
Many thanks