Minggu, 24 Juli 2011

RE: [MS_AccessPros] Display all records in subform datasheet

 

Deb-

I see several problems:

1) The partiddbl control on the outer form is bound to the expression =[ID].
The user will NEVER be able to enter a part ID because you have the control
bound to an expression. But I see ID is an AutoNumber, so maybe that's not a
problem. The control should be bound to ID, Locked = Yes, and take it out of
the tab order or set the tab order to the first editable control.

2) The PartDescriptionlbl control is bound to =[Part_Description]. As above,
the user will never be able enter a description for a new part because the
control is bound to an expression. You have the same problem with control
Text12 (=[Part_Size]) and control stockidlbl (=[Manufacturer_Part_Number])

3) On the subform, you have control Ext Tax Price bound to the expression:
=[Price]*[Tax]+[Price] There's a field in the underlying table called Ext Tax
Price, but it will NEVER be updated. You probably should not have this field in
your table - any calculated field like this should be calculated in a query
expression or in an expression on a form control as you have done.

4) You have the same problem as #3 with the control Total Cost

5) You have the same problem as #3 with the control Unit Price

6) You have a 1-1 relationship between the ID field in Parts_Inventory and the
ID field in Parts_Purchase, and both are AutoNumber. The form cannot deal with
this relationship because you can NEVER set a value in an AutoNumber field.
That's why you get "can't assign a value to this object" when you try to enter a
row in the subform. The subform cannot assign the related linking value to ID
in Parts_Purchase. And I assume you'll have multiple purchases over time, so
the Parts_Purchase table should perhaps be linked on Part_Number (which should
have a unique index in Parts_Inventory) and use the AutoNumber ID field in
Parts_Purchase to distinguish multiple rows.

The bottom line is your form doesn't work because you have a table design
problem.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Deb
Sent: Sunday, July 24, 2011 9:14 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Display all records in subform datasheet

Hi John,

I uploaded a zipped copy of my database to the files as I'm not sure how to
copy the code, sorry. It says Deb - Parts Purchase Subform Assistance.

It is the Parts_Purchase form that I am having problems with.... Please
note that the database is still very much under construction so not
everything is working.

Thank you for you help!!

Deb

On Sun, Jul 24, 2011 at 11:06 AM, John Viescas <john@viescas.com> wrote:

> Deb-
>
> Something funky is going on. Yes, a properly linked Datasheet form should
> show
> all the rows related to the outer form record. The "Can't assign a value
> to
> this object" message means you have a problem in the code or macro behind
> the
> form(s). Can you copy and paste ALL the code from both the form and the
> subform
> in a reply? When you get the error, do you see a Debug button? If so, you
> can
> click that to see the offending line of code.
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
>

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar