jschneider998
Technical User
Hello, Can anyone help me? I am trying to figure out a way to be able to add to my combo box dropdown list without having to keep going back to the original table....YIKES!!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim vResponse As Variant
If Len(NewData) > [red]30[/red] Then
MsgBox "The Data entered: '" & NewData & Chr(13) & "is " & Len(NewData) & " characters long." & Chr(13) & "The maximum is [red]30[/red] characters. Please re-enter"
Me![[i][red]ComboName[/red][/i]] = Null
Response = DATA_ERRCONTINUE
Else
NewData = Mid$(NewData, 1, [red]30[/red])
vResponse = MsgBox("Data entered '" & NewData & "' is not contained in current list." & Chr(13) & "Do you wish to add it to the file?", 36, "New Data Prompt")
If vResponse = 6 Then
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
DoCmd.DoMenuItem A_FORMBAR, A_EDIT, A_UNDOFIELD
Set MyDB = DBEngine(0)(0)
Set MyRS = MyDB.OpenRecordset("[i][red]yourtablename[/red][/i]")
MyRS.AddNew
MyRS("[i][red]fieldname[/red][/i]") = NewData
MyRS.Update
MyRS.Close
MyDB.Close
Response = DATA_ERRADDED
Else
Me![[i][red]ComboName[/red][/i]] = Null
End If
End If