I have a form which is is used to lookup customer information. This form is open in dialog mode so my users can select the correct customer and transfer data to my dataentry form. The problem I have is that this form should be availible on other forms, so in the OpenArg's argument I pass the calling forms name and would like to use this name in a With-block.
Currently I have this code behind the form:
I tried to use
But got an error on datatype mismatch.
The code works with the hard coded formname, but it isen't flexible enough, anybody
JR
Currently I have this code behind the form:
Code:
Option Compare Database
Option Explicit
Dim CallForm As String
Private Sub cmdOverfør_Click()
PassCustomerData
End Sub
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
CallForm = Me.OpenArgs
End If
End Sub
Private Sub PassCustomerData()
With Forms![COLOR=red]frmNySak
[/COLOR] !Kunde = Replace(Me!FIRMA, Chr(34), "")
!Adresse = Replace(Me!ADR1, Chr(34), "")
!POSTSTED = Left$(Me!POSTSTED, 4)
!epost = Me!E_POST
!merknader.SetFocus
End With
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
I tried to use
Code:
With Forms! & CallForm
....
End With
But got an error on datatype mismatch.
The code works with the hard coded formname, but it isen't flexible enough, anybody
JR