X
XXAA
I have a form that is filled in by data from a table and is saved to a
second table. This for creating an invoice from customer table, the reason
that I do this is so that the invoice has the correct details at time of
creation. If the customer address changes the previously created invoice
holds the old address which was current at the time of creation.
This is the code I use to fill in the form:
Dim MyDB As Database
Dim CustomerList As Recordset
Set MyDB = CurrentDb()
Set CustomerList = MyDB.OpenRecordset("Customer")
CustomerList.Index = "PrimaryKey"
CustomerList.Seek "=", Screen.ActiveControl
If CustomerList.NoMatch Then
DoCmd.GoToControl "Street"
Else
Me![CUSTOMERID] = [CustomerList]![CUSTOMERID]
Me![FName] = [CustomerList]![FName]
Me![Title] = [CustomerList]![Title]
Me![Street] = [CustomerList]![Street]
Me![City] = [CustomerList]![City]
Me![State] = [CustomerList]![State]
Me![PostCode] = [CustomerList]![PostCode]
Me![CompanyPhoneNumber] = [CustomerList]![CompanyPhoneNumber]
Me![Terms] = [CustomerList]![Terms]
DoCmd.GoToControl "CustomerID"
End If
What I want to do is use a Query as the data source and lieu of a Table
I have tried using QueryDef and QueryDefs but I have not got anywhere.
Any help would be appreciated.
Regards,
John A
second table. This for creating an invoice from customer table, the reason
that I do this is so that the invoice has the correct details at time of
creation. If the customer address changes the previously created invoice
holds the old address which was current at the time of creation.
This is the code I use to fill in the form:
Dim MyDB As Database
Dim CustomerList As Recordset
Set MyDB = CurrentDb()
Set CustomerList = MyDB.OpenRecordset("Customer")
CustomerList.Index = "PrimaryKey"
CustomerList.Seek "=", Screen.ActiveControl
If CustomerList.NoMatch Then
DoCmd.GoToControl "Street"
Else
Me![CUSTOMERID] = [CustomerList]![CUSTOMERID]
Me![FName] = [CustomerList]![FName]
Me![Title] = [CustomerList]![Title]
Me![Street] = [CustomerList]![Street]
Me![City] = [CustomerList]![City]
Me![State] = [CustomerList]![State]
Me![PostCode] = [CustomerList]![PostCode]
Me![CompanyPhoneNumber] = [CustomerList]![CompanyPhoneNumber]
Me![Terms] = [CustomerList]![Terms]
DoCmd.GoToControl "CustomerID"
End If
What I want to do is use a Query as the data source and lieu of a Table
I have tried using QueryDef and QueryDefs but I have not got anywhere.
Any help would be appreciated.
Regards,
John A