O
Owl Lover
Yesterday I asked the question regarding adding part numbers while in a form.
I tried the fix I got back but it's still not working properly. So I'm
asking again if anyone can help me. I've written the following code:
Dim strAQL As String
Dim i As Integer
Dim Msg As String
' Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Part Number...")
If i - vbYes Then
strSQL = "Insert Into tblPart# ([strPartNumber]) " & _
"Values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrContinue
Else
Response = acDataErrContinue
End If
End Sub
I have a part number and a part description. I need to give the user the
ability to add new part numbers and in turn type in the part description.
The problem is that this code allows me to type in a new part number, but
when I try to tab out of it to the part description field, it keeps asking me
if I want to add a new part number and won't let me out of that field, and
doesn't seem to save the part number I just typed in to the table. In
addition to adding a part number I have to be able to tab to the next field
which is the part description, and add that as well, then tab out of there
and have the part number and part description save to the table. It's
obvious I don't know what I'm doing, but I could really use some help!
Any help will be much appreciated!
Owl Lover
I tried the fix I got back but it's still not working properly. So I'm
asking again if anyone can help me. I've written the following code:
Dim strAQL As String
Dim i As Integer
Dim Msg As String
' Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Part Number...")
If i - vbYes Then
strSQL = "Insert Into tblPart# ([strPartNumber]) " & _
"Values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrContinue
Else
Response = acDataErrContinue
End If
End Sub
I have a part number and a part description. I need to give the user the
ability to add new part numbers and in turn type in the part description.
The problem is that this code allows me to type in a new part number, but
when I try to tab out of it to the part description field, it keeps asking me
if I want to add a new part number and won't let me out of that field, and
doesn't seem to save the part number I just typed in to the table. In
addition to adding a part number I have to be able to tab to the next field
which is the part description, and add that as well, then tab out of there
and have the part number and part description save to the table. It's
obvious I don't know what I'm doing, but I could really use some help!
Any help will be much appreciated!
Owl Lover