here's my current code:
Rich (BB code):
Private Sub Combo52_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
Dim stDocName 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 Book Category...")
If i = vbYes Then
Set Db = CurrentDb
Dim rcd As DAO.Recordset
'Set rcd = Db.OpenRecordset("Contacts")
'rcd.AddNew
'rcd![Combo52].Value = Me.Combo52.Text
'rcd.Update
'Response = acDataErrAdded
'rcd.Close
'stDocName = "Contact Details"
'DoCmd.OpenForm stDocName
stDocName = "Contact Details"
DoCmd.OpenForm stDocName
Else
Response = acDataErrContinue
End If
End Sub
I still can't find out what exactly the original code that was supplied does that i have commented out.
Here are a plethora of issues that I am having.
1)all of the same issues exist that I had when I used the macro builder (we are now using the code builder)
2) i am still unsure of how to make this form open to a new field rather than one that already exists.
3)When I try this with the already given default form "Contacts" it opens up a form that kind of "Pops Out" so to speak. This window doesn't exist as a tab where all other forms,queries, and tables go when they're opened. This default "Contacts" form has multiple fields that are filled after realizing that the last name exists. A first name, and other information.
I can use the code above to open up other forms that open as tabs across the window If and only if they have one field that im entering. So lets say I had a table called "Stores" with only the field "Stores" in it. I would be able to open up this form.
When i try the same thing with say a "Recipes" combo box everything goes down hill. Let's say that the recipes Table combo box is based off of "cake" then another field that contains "ingredients" in the same table . I believe the fact that it has more than one field that will have to be entered I am getting an issue.
Edit:
ID number is an automatic field
I forgot to mention, the line in bold:
Set rcd = Db.OpenRecordset("Contacts")
has been giving me an error. I can not determine why yet.
How can I do a refresh in the code to then have the newly inputted data appear in the combo box right after?