Code form for multi-use

M

Michael Walsh

I have a form that allows users to enter a section
summary. I have three buttons that open the summary up
for input. So each button has it's own routine like the
one below.

The problem is this. As expected if I'm creating new
summaries it doesn't work because the filter doesn't find
the appropriate form, but what I want it to do is if there
are no matching summaries I want it to create the
summaries.

The logic is something like this... If the given field is
Null set the values to this. The question is how can I
set the values using a vba routine for a form button that
opens a pop-up form. Can I set values for a form object
in a vba module?

The module looks like this...
Private Sub ClinSummaryButton_Click()
On Error GoTo Err_ClinSummaryButton_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmSummary"

stLinkCriteria = "[SiteVisitID]=" & Me![SiteVisitID]
& " and [SectionID]=1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ClinSummaryButton_Click:
Exit Sub

Err_ClinSummaryButton_Click:
MsgBox Err.Description
Resume Exit_ClinSummaryButton_Click

End Sub
 

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

Similar Threads


Top