Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

after combo bopop up the form of rowsource to fill other data

Status
Not open for further replies.

ronaldlee

IS-IT--Management
Oct 31, 2002
9
0
0
HK
The follows I found from forum here to add Newdata(customer name), which is not in combo box list, to the rowsource table. combo82_notInlist is working well, but error occurs in "Me![Combo82]" under Combo82_AfterUpdate as access alerts.

Please kindly help to solve this error and provide me with an example to pop up the form of rowsource focusing on the Newdata to fill other data, such as customer's telephone No., fax No. etc. after Newdata added

Dim blnRecordAdded As Boolean

Private Sub Combo82_AfterUpdate()
Dim rst As Recordset

' If a new record was just added, requery the form
If blnRecordAdded Then
Me.Requery
blnRecordAdded = False
End If

' Find the record that matches the control.
Set rst = Me.RecordsetClone
rst.FindFirst "[MembershipID] = " & Me![Combo82] & ""
Me.Bookmark = rst.Bookmark
' Optional - position the cursor in the first field
' to be entered as a convenience for the user
FirstName.SetFocus
End Sub

Private Sub Combo82_NotInList(NewData As String, Response As Integer)
If MsgBox("Customer not found. Add new customer?", vbYesNo Or vbQuestion) = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblMain (MembershipID) " _
& "VALUES('" & NewData & "')"
DoCmd.SetWarnings True
blnRecordAdded = True
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub

Thank you very much for your kind assistance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top