Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Dlookup problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Narpal - 31 Mar 2005 10:57 GMT
In a form, I enter a number into a field, what I have is many records, and
lots of  duplicate information.  It is a database of vehicle information.  
When filtered down to a particular Model I may get between 1 and 100 records,
what I need to do is use that entered number in the field on the form and
have it copied automatically, after clicking a button on the form, into all
the relevant field cells according to what model it is.  Currently I'm using
CTRL+ Apstrophe ( ' ), which copies the entry which is in the previous cell,
this is very time consuming.  Below is the code that I've tried, but it
dosen't work, has anyone got the right coding that I can try.

Private Sub ProdVols05_AfterUpdate()
   Dim varX As Variant
   varX = DLookup("[prodvols05]", "Main details", [ModelName])
End Sub
Terry - 31 Mar 2005 15:01 GMT
I think the syntax for DLookup is
DLookup(<Fieldname>,<Tablename>,<Where Clause>)
meaning that [Modelname] should be "[Modelname] = " &[ModelName]

varX = DLookup("[prodvols05]", "Main details", "[ModelName] = " &[ModelName])
Terry

> In a form, I enter a number into a field, what I have is many records, and
> lots of  duplicate information.  It is a database of vehicle information.  
[quoted text clipped - 10 lines]
>     varX = DLookup("[prodvols05]", "Main details", [ModelName])
> End Sub
Tim Ferguson - 31 Mar 2005 17:54 GMT
> what I need to do is use that entered number in the field on the form
> and have it copied automatically, after clicking a button on the form,
> into all the relevant field cells according to what model it is.  

 strSQL = "UPDATE MyTable " & _
   "SET SomeNumber = " & Me!NumberControl.Value & " " & _
   "WHERE Model = " & Quoted(Me!ModelDescription)

 Currentdb().Execute strSQL, dbFailOnError

I don't think that DLookup comes into it..?

HTH

Tim F
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.