gakiss2
Registered User.
- Local time
- Today, 15:27
- Joined
- Nov 21, 2018
- Messages
- 168
Below is some code to allow user to enter a category into Combo53. It works for MRR DLog skinny but does not for MRR DLog Output skinny. for the 'Output version I had copied this form frmMRRLog then made mods and named it frmMRRLogALL, I only mention because that is the only thing I recall changing between the two.
Now I get an error message runtime 2113 - value isn't valid for the field after I enter a new value. It works fine if I select an item already on the list. And it is actually 'working' in that the new item that I am adding does get onto the list because you can click out of the error, delete the new item from the combo box, close the form then re-open it. Then when you click the combo, the new one you entered last time is there in the list and, of course you can select it. I've compared the code between the two dbs and it seems exactly the same to me, perhaps I've missed something. I guess I should consider myself lucky that MRR DLog works but I had made some good progress on MR DLog Output and would hate to lose it and if I don't know what went wrong I suppose I am likely to repeat the error.
I greatly appreciate any help on this issue.
Thank YOU
Private Sub Combo53_NotInList(NewData As String, Response As Integer)
StrNew = NewData
strTmp = "Add '" & NewData & "' as a new category?"
DoCmd.SetWarnings False
If MsgBox(strTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then
DoCmd.RunSQL "INSERT INTO tblCategory " _
& "(VendorName,Category) VALUES " _
& "(Forms!frmMRRLog!SupplierName,""" & NewData & """);"
'Neither fixed the issue, tried nothing and got same behavior, may need to add back???
'Try different statement
Response = dbErrorAdded
' Response = acDataErrContinue
'loops
With Forms("frmMRRLog").Controls("Combo53")
.ColumnWidths = "0.25 in.;0 in.;1 in."
.LimitToList = False
End With
RunCommand acCmdSaveRecord
With Forms("frmMRRLog").Controls("Combo53")
.ColumnWidths = "0 in.;0 in.;1 in."
.LimitToList = True
End With
Me.Combo53.Requery
DoCmd.SetWarnings True
End If
End Sub
Now I get an error message runtime 2113 - value isn't valid for the field after I enter a new value. It works fine if I select an item already on the list. And it is actually 'working' in that the new item that I am adding does get onto the list because you can click out of the error, delete the new item from the combo box, close the form then re-open it. Then when you click the combo, the new one you entered last time is there in the list and, of course you can select it. I've compared the code between the two dbs and it seems exactly the same to me, perhaps I've missed something. I guess I should consider myself lucky that MRR DLog works but I had made some good progress on MR DLog Output and would hate to lose it and if I don't know what went wrong I suppose I am likely to repeat the error.
I greatly appreciate any help on this issue.
Thank YOU
Private Sub Combo53_NotInList(NewData As String, Response As Integer)
StrNew = NewData
strTmp = "Add '" & NewData & "' as a new category?"
DoCmd.SetWarnings False
If MsgBox(strTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then
DoCmd.RunSQL "INSERT INTO tblCategory " _
& "(VendorName,Category) VALUES " _
& "(Forms!frmMRRLog!SupplierName,""" & NewData & """);"
'Neither fixed the issue, tried nothing and got same behavior, may need to add back???
'Try different statement
Response = dbErrorAdded
' Response = acDataErrContinue
'loops
With Forms("frmMRRLog").Controls("Combo53")
.ColumnWidths = "0.25 in.;0 in.;1 in."
.LimitToList = False
End With
RunCommand acCmdSaveRecord
With Forms("frmMRRLog").Controls("Combo53")
.ColumnWidths = "0 in.;0 in.;1 in."
.LimitToList = True
End With
Me.Combo53.Requery
DoCmd.SetWarnings True
End If
End Sub