copy fields from Form to new form - openargs
Hi,
the control on the separtate edit form is
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sales Enquiry Register1"
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me![Enquiry/Quote] ' open argument
When the new form opens, it is a separate form, the "OnOpen" event is
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strsql As String
Set dbs = CurrentDb
strsql = "SELECT * FROM [Sales Enquiry Register] "
strsql = strsql & "WHERE [Enquiry/Quote] = " & CLng(Me.OpenArgs)
Set rst = dbs.OpenRecordset(strsql, dbOpenDynaset)
If Me.OpenArgs And Len(Trim(Nz(Me.OpenArgs, ""))) > 0 Then
'do something
Me![Ref] = rst.Fields![Enquiry/Quote]
Rem Me!Ref = OpenArgs
Else
'do something
End If
The idea was to use openargs and populate the new form with data from the old.
Its a quote revision.
The new form has a new number and the ref field has the old number in it.
Trouble is on the line
Me![Ref] = rst.Fields![Enquiry/Quote]
I get an error 2448 that you can't assign a value to this object.
The underlying table is common to both forms.
Help required.
Regards
Bill
|