Problem of Common Form & Str() vs CStr()?

bluy

New member
Local time
Tomorrow, 03:57
Joined
Sep 1, 2004
Messages
1
Hi, I'm a beginner of programming access. I have several tables which have the same structure and named by the years (eg: 1999,2004). I create a common form to show them. I use the following code to do that:

DoCmd.OpenForm "frmCommon", , , strSQL, acFormReadOnly, acHidden
:confused: ' if I use Str() instead, I'll get error message, WHY?
Forms!frmCommon.RecordSource = CStr(Year(Now()))
Forms!frmCommon.Filter = strSQL
Forms!frmCommon.FilterOn = True
Forms!frmCommon!cmdPrint.Enabled = False
Forms!frmCommon!cmdPrint.Visible = False
DoCmd.SelectObject acForm, "frmCommon", False

:confused: AND what I do is a good way to finish the work? Can anyone give me some advices? Thanks!
 

Users who are viewing this thread

Back
Top Bottom