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!

Applying actions to another form than the one where the event occur ??

Status
Not open for further replies.

tintin007

Technical User
Aug 11, 2000
8
0
0
CA
Hi,

I'm trying to copy the texte I've freshly enter in a field into a specific field of an ADD CUSTOMER form... just to avoid my users to have to enter the info twice.

So my code is at this point:


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

On Error GoTo Err_NumClient_NotInList

Dim intAnswer As Integer

intAnswer = msgbox("Ce client n'existe pas! Voulez-vous l'ajouter?", vbYesNo + vbQuestion, "Client Innexistant")
If intAnswer = vbYes Then
DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm "frm_AjoutClient", acNormal, , , acFormEdit, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

Exit_NumClient_NotInList:
Exit Sub

Err_NumClient_NotInList:
msgbox Err.Description
Resume Exit_NumClient_NotInList
End Sub


_______
What it is missing to achieve my objective???
Thank you very much

:cool:
[sig][/sig]
 
tintin007 here is how I have done it.

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


Dim strMessage As String
Dim dbs As Database
Dim rst As Recordset

strMessage = NewData & " was not in the list." & vbNewLine _
& "Do you want to add ' " & NewData & " ' to the list?"
If Confirm(strMessage) Then
'Open the Business Types table and add.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblBusinessTypes")
With rst
.AddNew
!BusType = NewData
.Update
End With
Response = acDataErrAdded 'this requeries the list
Else
Response = acDataErrDisplay 'display the error
End If

End Sub
[sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top