Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Access 2007 report from 2 tables

Avatar of gbnorton
gbnortonFlag for United States of America asked on
Microsoft Access
16 Comments1 Solution448 ViewsLast Modified:
I am working with two tables for the first time…  Glassing_Yield and Glassing_Inspection

I used Database Tools Relationships to join the tables using the field Glassing_Lot that exists in both tables.

On my form the operator uses a combo box to select the  Date_Time, Glassing_Lot, PN, and Starting Qty from Glassing_Yield.  The info is displayed to the operator.

The operator then enters the End Qty and Operator.

I use this code to save the record to Glassing_Inspection:

Private Sub Save_and_exit_Click()
Dim OkToExit As Boolean

OkToExit = False
OkToExit = CheckDataBeforeSaveAndExit()

If OkToExit = True Then
    With CurrentDb.OpenRecordset("Glassing_Inspection")
      .AddNew
      ![Date_Time] = Now()
      ![Operator] = Me.lstOperator
      ![Glassing_Lot] = Me.txtGlassing_Lot
      ![Yield] = Me.txtEndQty
      .Update
    End With
    OkToExit = PrintLabels()
    DoCmd.Close
End If

The record saves correctly to Glassing_Inspection.  Now I want to print a report(really it’s a label) using that  record.  The report also needs to get the PN from Glassing_Yield that matches the Glassing_Lot.   And finally also print the sum of quantities from End Qty in Glassing_Yield for that Glassing_Lot...

The report Control Source is Glassing_Inspection.
In the report I have:
Text Box            Control Source
txtGlassingLot      Glassing_Lot
txtPN            =[Glassing_Yield]![PN]
txtOperator            Operator
txtStartQty            =DSum("[End_Qty]","[Glassing_Yield]","[Glassing_Lot] = '" & Me.txtGlassing_Lot & "'")
txtEndQty            Yield
txtDateTime            Date_Time

In the code above PrintLabels() executes this code:
DoCmd.OpenReport "Glassing Inspection Label", acViewNormal, , "[ID]=" & Me.ID
The report fails with the error “No Record Found” on that line.

I hope in all this info you can tell me where I went wrong.

Thanks,
Brooks
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Commented:
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answers