Steve,
I don't have a problem with a continuous form. I just converted it. It
works fine. I have never put a command button on a subform before and I am
having trouble with the linkage. The link between the from and the subform
is GuestID from the Stays table and ID (Primary Key) from the Guests table.
That form/subform works very well. But I cannot get the invoice
form/subform to populate data. It opens and does not give an error, but no
data. Here is the code behind the command button:
Private Sub cmdBillInvoice_Click()
On Error GoTo Err_cmdBilltoInvoice_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmBilltoInvoice"
stLinkCriteria = "[BillID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdBilltoInvoice_Click:
Exit Sub
Err_cmdBilltoInvoice_Click:
MsgBox Err.Description
Resume Exit_cmdBilltoInvoice_Click
End Sub
Here is the SQL for the form and the subform.
First the form:
SELECT [tblMainGuests].[ID], [tblMainGuests].[LastName],
[tblMainGuests].[FirstName], [tblMainGuests].[MI],
[tblMainGuests].[FirstName2], [tblMainGuests].[MI2],
[tblMainGuests].[LastName2], [tblMainGuests].[Address1],
[tblMainGuests].[Address2], [tblMainGuests].[City], [tblMainGuests].[State],
[tblMainGuests].[Province], [tblMainGuests].[PostalCode],
[tblMainGuests].[Country], [tblMainGuests].[AddressAlt1],
[tblMainGuests].[AddressAlt2], [tblMainGuests].[City2],
[tblMainGuests].[State2], [tblMainGuests].[Province2],
[tblMainGuests].[PostalCode2], [tblMainGuests].[Country2],
[tblMainGuests].[Company], [tblMainGuests].[Title],
[tblMainGuests].[HomePhone], [tblMainGuests].[HomePhone2],
[tblMainGuests].[WorkPhone], [tblMainGuests].[Fax],
[tblMainGuests].[CellPhone], [tblMainGuests].[E-Mail],
[tblMainGuests].[GuestMemo], [tblMainGuests].[ContactTypeID],
[tblMainGuests].[ReferralTypeID], [tblMainGuests].[PurchaseID],
[tblMainGuests].[NoMail], [tblMainGuests].[DateRecordCreated],
[tblMainGuests].[DateRecordUpdated], ([FirstName] & " "+[MI] & " " &
[LastName] & " and "+[FirstName2] & " "+[MI2] & " "+[LastName2]) AS [NAMES],
([Address1] & " " & [Address2]) AS ADDRESSES, ([City] & ", " &
(IIf(IsNull([State]),[Province],[State])) & " " & (IIf([Country]="USA","
",[Country])) & " " & [PostalCode]) AS STATEPROVINCE, ([FirstName] & "
"+[MI] & " " & [LastName]) AS NAME1, ([FirstName2] & " "+[MI2] & " " &
[LastName2]) AS NAME2, [tblMainGuests].[CardID]
FROM tblMainGuests
ORDER BY [tblMainGuests].[LastName], [tblMainGuests].[FirstName];
Now the subform:
SELECT [qryMainStays].[StayID], [qryMainStays].[Rate],
[qryMainStays].[Deposit], [qryMainStays].[ReserveDate],
[qryMainStays].[StayStart], [qryMainStays].[StayLength],
[qryMainStays].[StayMemo], [qryMainStays].[TaxExempt],
[qryMainStays].[GuestID], [qryMainStays].[GuestsperRoom],
[qryMainStays].[WeeklyStay], [qryMainStays].[RoomsID] FROM qryMainStays;
The linkage for the connection between the Stays table and the invoice table
is BillID for the Stays table and ID (Primary Key) for the invoice table.
Sorry about the length of this. I hope this is enough info to help figure
this out.
Best regards,
Scott B