not saving addition to row source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a problem with an event procedure that I have set up for a NotInList
Event. It adds the the item to the Row Source, so it will appear in the drop
down for future records. It works fine, however when I close the form and
reopen it, all of the additions that had previously been made are gone.

The only time I've gotten it to work, where it kept the additions, was if I
happened to open the event procedure in VB. The when I got to close the
form, it prompts me to save it, and I do. In that situation it keeps the
additions to the row source and they are there the next time I open the form.
I've tried just saving the form, but it doesn't seem to work unless I opened
the code in VB. I have no idea why that would make a difference but for some
reason it does.

any help would be much appreciated!
 
Krissie:

The following KB article may be useful, depending on your circumstances. If
you are still having difficulty, you may want to post your code.

http://support.microsoft.com/default.aspx?scid=kb;en-us;197526

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I have a problem with an event procedure that I have set up for a NotInList
Event. It adds the the item to the Row Source, so it will appear in the
drop
down for future records. It works fine, however when I close the form and
reopen it, all of the additions that had previously been made are gone.

The only time I've gotten it to work, where it kept the additions, was if I
happened to open the event procedure in VB. The when I got to close the
form, it prompts me to save it, and I do. In that situation it keeps the
additions to the row source and they are there the next time I open the
form.
I've tried just saving the form, but it doesn't seem to work unless I
opened
the code in VB. I have no idea why that would make a difference but for
some
reason it does.

any help would be much appreciated!
 
That didn't really help, as it's set up with a table, and mine is not. Here
is my code

Private Sub Combo14_NotInList(NewData As String, Response As Integer)

Dim ctl As Control

' Return Control object that points to combo box.
Set ctl = Me!Combo14

' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData


End Sub

Again, it works just fine, until I close the form, then when I reopen it,
everything that was added to the list last time isn't there.

Thanks!
 
I've alos tried two other codes all with the same outcome, they work fine
until i close the form, then when I reopen it everything that had been added
isn't there.

Private Sub Combo14_NotInList(NewData As String, Response As Integer)


'Add the value to the RowSource property
Me.Combo14.RowSource = Me.Combo14.RowSource & ";" & NewData

'Tell Access you've added the new value
Response = acDataErrAdded

End Sub

also this code

Private Sub Events_NotInList(NewData As String, Response As Integer)

Dim ctl As Control

' Return Control object that points to combo box.
Set ctl = Me!events
' Prompt user to verify they wish to add new value.
If MsgBox("Event is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top