PC Review


Reply
Thread Tools Rate Thread

DLookup referencing a subform

 
 
Stella Pieters via AccessMonster.com
Guest
Posts: n/a
 
      9th Jun 2005
L.S.

The intention of the following code is to lookup the artDescrip in the
contraceptive table, using the description (which is a combobox) from the
subform visits1. The main form is called "registration form".

I coded it as follows:


Dim varX As Variant

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Transaction Table", dbOpenTable)

varX = DLookup("[ArtDescrip]", "Contraceptives", "[Contraceptives] = '" _
& Forms![REGISTRATION FORM]![visits1]!Contraceptives)

rst("ArtDescrip") = varX

Could you please give me a hint on how to do this, as I'm getting the run
error 438, saying that "object does not support this object or method".

Thanks in advance

Stella Pieters

--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
 
 
 
Marshall Barton
Guest
Posts: n/a
 
      9th Jun 2005
Stella Pieters via AccessMonster.com wrote:
>The intention of the following code is to lookup the artDescrip in the
>contraceptive table, using the description (which is a combobox) from the
>subform visits1. The main form is called "registration form".
>
>I coded it as follows:
>
>Dim varX As Variant
>
>Set dbs = CurrentDb
>Set rst = dbs.OpenRecordset("Transaction Table", dbOpenTable)
>
>varX = DLookup("[ArtDescrip]", "Contraceptives", "[Contraceptives] = '" _
> & Forms![REGISTRATION FORM]![visits1]!Contraceptives)
>
> rst("ArtDescrip") = varX
>
>Could you please give me a hint on how to do this, as I'm getting the run
>error 438, saying that "object does not support this object or method".



The DLookup needs the closing quotes on the condition:

varX = DLookup("[ArtDescrip]", "Contraceptives", _
"[Contraceptives] = '" & _
Forms![REGISTRATION FORM]![visits1]!Contraceptives & "'")

But it seems like the rules of normalization preclude doing
this. As long as the transaction table has the
Contraceptives field, there is no need to copy the
ArtDescrip from the Contraceptives table.

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
Stella Pieters via AccessMonster.com
Guest
Posts: n/a
 
      15th Jun 2005
Thank you very much for your help.

--
Message posted via http://www.accessmonster.com
 
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
Re: Referencing a control on subform 1 from subform 3 causes access to crash Tom van Stiphout Microsoft Access Queries 0 15th Feb 2010 02:42 PM
Referencing Dlookup in subform Melissa Microsoft Access 1 4th Nov 2008 10:02 PM
Referencing a table while using Dlookup on a form nxqviet@gmail.com Microsoft Access Form Coding 4 21st Sep 2006 11:17 PM
Trying to disable subform (and have read webpage on subform property referencing) rgrantz Microsoft Access Form Coding 3 7th Dec 2004 03:31 AM
Urgent Help Needed: Referencing a control on a subform's subform =?Utf-8?B?VHJpc2hhQg==?= Microsoft Access Form Coding 7 3rd Nov 2004 04:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.