PC Review


Reply
Thread Tools Rate Thread

How to auto-post editable lookups?

 
 
WDSnews
Guest
Posts: n/a
 
      15th Apr 2009
When using an invoice form, it should be possible to look up all the line
item data and duplicate it into the detail table. but how?

I know how to build a combo box to reveal data from a related table, but I
don't know how to copy multiple fields from its record to a different record
of a different table. It should be possible to select an 'Apple' detail
item on the Invoice subform and let Access fill-in the line-item details,
including the description and price. Then it should be possible on the
Invoice's subform to manually change the price and description if desired.

I'm assuming three tables would be used: 'Invoice', 'Invoice Detail', and
'Items'. The 'Invoice Detail' is the child table of 'Invoice'. The 'Items'
table would hold all the lookup data for the 'Invoice Detail'. What do I
need to do in my tables and on my form to enable automatic data entry of
'Invoice Detail'?



 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      15th Apr 2009
"WDSnews" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When using an invoice form, it should be possible to look up all the line
> item data and duplicate it into the detail table. but how?
>
> I know how to build a combo box to reveal data from a related table, but I
> don't know how to copy multiple fields from its record to a different
> record of a different table. It should be possible to select an 'Apple'
> detail item on the Invoice subform and let Access fill-in the line-item
> details, including the description and price. Then it should be possible
> on the Invoice's subform to manually change the price and description if
> desired.
>
> I'm assuming three tables would be used: 'Invoice', 'Invoice Detail', and
> 'Items'. The 'Invoice Detail' is the child table of 'Invoice'. The
> 'Items' table would hold all the lookup data for the 'Invoice Detail'.
> What do I need to do in my tables and on my form to enable automatic data
> entry of 'Invoice Detail'?



One of the easiest ways to do this is to use a combo box with multiple
columns. The description and price columns may or may not be visible when
the list is dropped down, and of course you can only see one column -- the
first visible column -- when the list is collapsed. But you can still copy
information from the invisible columns into the other fields in the subform
record, in the combo box's AfterUpdate event.

Suppose your subform (based on ItemDetails) has a combo box ItemCode and
text boxes ItemDescription and Price. Suppose that the ItemCode combo box
has 3 columns, with a rowsource like this:

SELECT ItemCode, ItemDescription, Price FROM Items;

Then you could have an AfterUpdate event procedure for the combo box like
this:

'----- start of example code -----
Private Sub ItemCode_AfterUpdate()

With Me.ItemCode

If IsNull(.Value) Then
Me.ItemDescription = Null
Me.Price = Null
Else
Me.ItemDescription = .Column(1)
Me.Price = .Column(2)
End If

End With

End Sub
'----- end of example code -----

Notice that, in VBA code, the second column of the combo box is .Column(1),
and the third column is .Column(2). A combo box's Column property is
0-based.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
WDSnews
Guest
Posts: n/a
 
      17th Apr 2009
thank you.


"Dirk Goldgar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "WDSnews" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> When using an invoice form, it should be possible to look up all the line
>> item data and duplicate it into the detail table. but how?
>>
>> I know how to build a combo box to reveal data from a related table, but
>> I don't know how to copy multiple fields from its record to a different
>> record of a different table. It should be possible to select an 'Apple'
>> detail item on the Invoice subform and let Access fill-in the line-item
>> details, including the description and price. Then it should be possible
>> on the Invoice's subform to manually change the price and description if
>> desired.
>>
>> I'm assuming three tables would be used: 'Invoice', 'Invoice Detail',
>> and 'Items'. The 'Invoice Detail' is the child table of 'Invoice'. The
>> 'Items' table would hold all the lookup data for the 'Invoice Detail'.
>> What do I need to do in my tables and on my form to enable automatic data
>> entry of 'Invoice Detail'?

>
>
> One of the easiest ways to do this is to use a combo box with multiple
> columns. The description and price columns may or may not be visible when
> the list is dropped down, and of course you can only see one column -- the
> first visible column -- when the list is collapsed. But you can still
> copy information from the invisible columns into the other fields in the
> subform record, in the combo box's AfterUpdate event.
>
> Suppose your subform (based on ItemDetails) has a combo box ItemCode and
> text boxes ItemDescription and Price. Suppose that the ItemCode combo box
> has 3 columns, with a rowsource like this:
>
> SELECT ItemCode, ItemDescription, Price FROM Items;
>
> Then you could have an AfterUpdate event procedure for the combo box like
> this:
>
> '----- start of example code -----
> Private Sub ItemCode_AfterUpdate()
>
> With Me.ItemCode
>
> If IsNull(.Value) Then
> Me.ItemDescription = Null
> Me.Price = Null
> Else
> Me.ItemDescription = .Column(1)
> Me.Price = .Column(2)
> End If
>
> End With
>
> End Sub
> '----- end of example code -----
>
> Notice that, in VBA code, the second column of the combo box is
> .Column(1), and the third column is .Column(2). A combo box's Column
> property is 0-based.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LOOKUPS - Creating LOOKUPs where two different values must BOTH be satisfied. Mr Wiffy Microsoft Excel Worksheet Functions 2 16th May 2005 04:29 AM
LOOKUPS - Creating LOOKUPs where two different values must BOTH be satisfied. Mr Wiffy Microsoft Excel Discussion 1 15th May 2005 11:43 PM
How to convert editable word doc to editable html in a browser? =?Utf-8?B?Q2xldmVyIEFubg==?= Microsoft Word Document Management 1 22nd Mar 2005 05:18 AM
I want an editable Auto Reply for my eMail. What has to be done? =?Utf-8?B?Y2hpeGVtb3o=?= Microsoft Access 1 18th Oct 2004 08:14 PM
Auto Complete Textbox or Editable Dropdown (VB style) george d lake Microsoft ASP .NET 0 30th Oct 2003 04:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:00 AM.