W
Willem van der Berg
I've been working for about three days now to fix a problem that I do not
find particularly logical. I am more or less a beginner with Access though,
so I'm hoping a more experienced user can help me determine how to solve my
problem. I'll explain.
I've got a tblSupplierPurchases table with purchases from my suppliers. I've
made a frmParametersForm which allows the user to input certain parameters,
like date ranges, name of supplier etc. This form has a command button which
triggers another form. I'll call this one frmSupplierPurchasesForm. The
command button on frmParametersForm writes the parameters into global
variables. frmSupplierPurchasesForm gets it's information through
qryShowSupplierPurchases, this parameterquery contains all the fields of
tblSupplierPurchases and the parameters in the variables.
frmSupplierPurchasesForm shows me the records based on the user's
parameters.
And added twist is that I like to keep 'adding new purchases' and 'show
purchases' as seperate activities, but I use the same
frmSupplierPurchasesForm to do both activities: it's standard properties are
set to add new purchases (AllowAdditions, AllowDeletions, AllowEdits,
DataEntry, NavigationButtons, Caption). There's a subform control on this
form which shows the actual products that belong to the PurchaseID.
When I want to use the form just for showing results, I change the mentioned
proporties through the command button to reflect this change of purpose.
Here's my code:
NumberOfResults = DCount("PurchaseID",
"qryShowSupplierPurchases")
If NumberOfResults > 0 Then
Form_frmSupplierPurchasesForm.RecordSource =
"qryShowSupplierPurchases"
Form_frmSupplierPurchasesForm.AllowAdditions = False
Form_frmSupplierPurchasesForm.AllowDeletions = True
Form_frmSupplierPurchasesForm.AllowEdits = True
Form_frmSupplierPurchasesForm.DataEntry = False
Form_frmSupplierPurchasesForm.NavigationButtons = True
Form_frmSupplierPurchasesForm.lblTitle.Caption = "Show
Purchases"
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowAdditions = True
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowDeletions = True
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowEdits
= True
Form_frmSupplierPurchasesForm.SubFormControl.Form.DataEntry
= False
Form_frmSupplierPurchasesForm.SubFormControl.Form.NavigationButtons = False
Form_frmSupplierPurchasesForm.SetFocus
Else
(MsgBox etc. etc.)
End If
Now, the problem is that I've been getting the run-time error 2455: You
entered an expression that has an invalid reference to the property
Form/Report with
"Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowAdditions = True"
highlighted. I can't really see anything wrong with this code, it has run
before without problems but now it will always give the error.
I have checked all my tables, queries and forms and I can't see anything
wrong with it. The reason why I think there's an Access bug at work is
because when I have picked the parameters and run qryShowSupplierPurchases
manually, it returns the results as expected. Not surprising, as
NumberOfResults checks this as well. I can't work out why the
frmSupplierPruchasesForm won't show the results though...
I have checked the internet for any similar problems, found them, which made
me believe there's a bug at work, but I've never seen the solution... I run
Windows XP Home, use Access 2000 and I have SP3 installed and the latest
version of the Jet engine.
If I have made a mistake (don't point out typo's, I use Dutch names in the
actual database) I would really like to know how to fix it. If there's
indeed a bug at work I would like to know how to work around it.
Any help would be greatly appreciated!!! Thanks in advance. As I said, I'm a
relative beginner and these kind of problems seriously undermine my
confidence in working with Access
Best regards,
Willem van der Berg.
find particularly logical. I am more or less a beginner with Access though,
so I'm hoping a more experienced user can help me determine how to solve my
problem. I'll explain.
I've got a tblSupplierPurchases table with purchases from my suppliers. I've
made a frmParametersForm which allows the user to input certain parameters,
like date ranges, name of supplier etc. This form has a command button which
triggers another form. I'll call this one frmSupplierPurchasesForm. The
command button on frmParametersForm writes the parameters into global
variables. frmSupplierPurchasesForm gets it's information through
qryShowSupplierPurchases, this parameterquery contains all the fields of
tblSupplierPurchases and the parameters in the variables.
frmSupplierPurchasesForm shows me the records based on the user's
parameters.
And added twist is that I like to keep 'adding new purchases' and 'show
purchases' as seperate activities, but I use the same
frmSupplierPurchasesForm to do both activities: it's standard properties are
set to add new purchases (AllowAdditions, AllowDeletions, AllowEdits,
DataEntry, NavigationButtons, Caption). There's a subform control on this
form which shows the actual products that belong to the PurchaseID.
When I want to use the form just for showing results, I change the mentioned
proporties through the command button to reflect this change of purpose.
Here's my code:
NumberOfResults = DCount("PurchaseID",
"qryShowSupplierPurchases")
If NumberOfResults > 0 Then
Form_frmSupplierPurchasesForm.RecordSource =
"qryShowSupplierPurchases"
Form_frmSupplierPurchasesForm.AllowAdditions = False
Form_frmSupplierPurchasesForm.AllowDeletions = True
Form_frmSupplierPurchasesForm.AllowEdits = True
Form_frmSupplierPurchasesForm.DataEntry = False
Form_frmSupplierPurchasesForm.NavigationButtons = True
Form_frmSupplierPurchasesForm.lblTitle.Caption = "Show
Purchases"
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowAdditions = True
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowDeletions = True
Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowEdits
= True
Form_frmSupplierPurchasesForm.SubFormControl.Form.DataEntry
= False
Form_frmSupplierPurchasesForm.SubFormControl.Form.NavigationButtons = False
Form_frmSupplierPurchasesForm.SetFocus
Else
(MsgBox etc. etc.)
End If
Now, the problem is that I've been getting the run-time error 2455: You
entered an expression that has an invalid reference to the property
Form/Report with
"Form_frmSupplierPurchasesForm.SubFormControl.Form.AllowAdditions = True"
highlighted. I can't really see anything wrong with this code, it has run
before without problems but now it will always give the error.
I have checked all my tables, queries and forms and I can't see anything
wrong with it. The reason why I think there's an Access bug at work is
because when I have picked the parameters and run qryShowSupplierPurchases
manually, it returns the results as expected. Not surprising, as
NumberOfResults checks this as well. I can't work out why the
frmSupplierPruchasesForm won't show the results though...
I have checked the internet for any similar problems, found them, which made
me believe there's a bug at work, but I've never seen the solution... I run
Windows XP Home, use Access 2000 and I have SP3 installed and the latest
version of the Jet engine.
If I have made a mistake (don't point out typo's, I use Dutch names in the
actual database) I would really like to know how to fix it. If there's
indeed a bug at work I would like to know how to work around it.
Any help would be greatly appreciated!!! Thanks in advance. As I said, I'm a
relative beginner and these kind of problems seriously undermine my
confidence in working with Access
Best regards,
Willem van der Berg.