Well as luck would have it the access app I have sort of works. Here
is the current issue.
The names are in a combo box and it populates fine, and when I select a
name it populates the rest of the form with their data. When I click the
button to add a new person though, this is where my issue arises. I
click the add new button, the form is blank as it should be. I add the
persons name then tab over to the next field. The control refreshes when
I do this and when I add the information into the rest of the fields,
they get inserted into a new row. So lets say I have 36 people in the
database. I add a new person, and in the user name field the new name is
there on line 37. The rest of the information is inserted in line 38
though. Here is my code that populates the list and also the code for
adding a new person.
Code that populates the list:
Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ID_ID] = " & Me.cboMoveTo
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
Code that adds a new record:
Private Sub CboMoveTo_NotInList(NewData As String, Response As Integer)
'Allow user to save non-list items.
Dim cnn As New ADODB.Connection
Dim strSQL As String
Dim bytUpdate As Byte
On Error GoTo ErrHandler
Set cnn = CurrentProject.Connection
bytUpdate = MsgBox("Do you want to add " & cboMoveTo.Value & " to the
list?", vbYesNo, "Non-list item!")
If bytUpdate = vbYes Then
strSQL = "INSERT INTO Users(User_Name) " & "VALUES ('" & NewData & "')"
Debug.Print strSQL
cnn.Execute strSQL
Response = acDataErrAdded
ElseIf bytUpdate = vbNo Then
Response = acDataErrContinue
Me!cboMoveTo.Undo
End If
Exit Sub
ErrHandler:
MsgBox Err.Number & ": " & Err.Description, vbOKOnly, "Error"
End Sub
I looked all though this but cannot see what is making this happen.
Thanks again in advance,
Bruce
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:325610
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm