Please help, database attached.

cpt2014

New member
Local time
Today, 12:44
Joined
May 23, 2014
Messages
6
Hello,

Its my first time posting on this forum. (although have been looking through it for months to try and learn access) I have a database (attached).

I have a button on my Data entry form (EquipmentExamination2) and when the information is filled in I would like the button to generate the report ( ExaminationReport ) with the current record on form so I can print it.

I hate having to ask as I like to learn on my own but I have been trying to do this for 2 days now scouring this forum and would like someone to take a look and see what is wrong with my database an why I can not get the button to work.

as I say i'm pretty new to access and coding.

Any help I would be most grateful!
 

Attachments

  1. When you want to printout the current information you've put into the form, then you first need to save it.
  2. You need to apply a filter when you open the report.
 
Hi thanks for your reply,

that's what I am having the trouble with. I would be able to add a button to save the record first (i've even tried that) but I need help with the code I have to put behind the Open report button. I've tried lots of codes from this forum but nothing seems to work.
 
Paste in the code below, (change it from macro to a [Event Procedure]) :
Code:
Private Sub OpenReport_Click()
  If Me.Dirty Then
    Me.Dirty = False
  End If
  DoCmd.OpenReport "ExaminationReport", acViewPreview, , "ID=" & Me.ID
End Sub
Some other things you have to correct before you can see the above code works:
The combobox for the company is unbound.
Then your relationship/table structure isn't correct because of the link between the 2 autonumber fields.
 
ah ok thanks for the code.. so should I just delete the relationships from the two tables? would that work then?
 

Users who are viewing this thread

Back
Top Bottom