Checkbox on Datasheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, i need some help with the following code. what i am trying to do is to
print a report when a cmdbutton is clicked, but the report is populated
according to the checkbox. i am new to this, can anyone help me with figuring
out what i am doing wrong.

Dim strProductID As String
If Me.Produce.Form = True Then
strProductID = "rptProduction"
DoCmd.OpenReport strProductID, acViewPreview, , "[ProductID]='" &
forms! subfrmMattProduce![ProductID] & "'"

End If
 
delimiters, Subform Control vs Subform, Access Basics
---


Hi Will,

If ProductID is numeric, you should not use delimiters. Also, when you
are referring to a control on a subform, you need .form after the
subform reference

"[ProductID]=" & me.subfrmMattProduce.form![ProductID]

I am assuming you are in the code behind the mainform and can use a
relative reference. 'Me.' refers to the form you are behind

I do not understand how the checkbox figures in...

what are you trying to refer to with
Me.Produce.Form
?

~~~~
*** Difference between Subform Control and Subform ***

The first click on a subform control puts handles* around the subform
object.
*black squares in the corners and the middle of each size -- resizing
handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it directly
from the database window and it has the same properties of the main
form. It is only called a subform because of the way it is being used.

To summarize, when you are in the design view of the main form, the
first click on the subform is the subform control -- you will see the
handles around the edges -- and the second click gets you INTO it -- you
will see a black square where the rulers intersect in the upper left of
the "form" you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform control

'~~~~~~~~~~~~
to help you understand Access a bit better, send me an email and request
my 30-page Word document on Access Basics (for Programming) -- it
doesn't cover VBA, but prepares you for it because it covers essentials
in Access. I do also send out the first 3 chapters of a book I am
writing on VBA to all who request it.

Be sure to put "Access Basics" in the subject line so that I see your
message...
~~~~~~~~~~~~~~~~~~



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top