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 / General 2 / March 2007

Tip: Looking for answers? Try searching our database.

How can I assign a value to a declared variable in a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Timmy - 28 Mar 2007 14:08 GMT
I need to assign a value from a table to a declared variable in VBA (a
declared variable "Number" takes on a value from table X) It's probably not
hard, but i'm confused about the syntax
Allen Browne - 28 Mar 2007 14:19 GMT
Use DLookup() to get the value from the field, e.g.:
   X  = DLookup(...

For help on DLookup(), see:
   http://allenbrowne.com/casu-07.html

Note that X must be declared as a Variant, since the DLookup() could return
Null.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I need to assign a value from a table to a declared variable in VBA (a
> declared variable "Number" takes on a value from table X) It's probably
> not
> hard, but i'm confused about the syntax
Timmy - 28 Mar 2007 14:50 GMT
I did that but I get an "Overflow" error for some reason

> Use DLookup() to get the value from the field, e.g.:
>     X  = DLookup(...
[quoted text clipped - 9 lines]
> > not
> > hard, but i'm confused about the syntax
Allen Browne - 28 Mar 2007 14:58 GMT
Did you start the procedure with:
   Dim X As Variant

If that doesn't solve it post your procedure.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I did that but I get an "Overflow" error for some reason
>
[quoted text clipped - 12 lines]
>> > not
>> > hard, but i'm confused about the syntax
Timmy - 28 Mar 2007 15:14 GMT
It did work. I changed it from an interger to a double and it works great.
Thank you very much

> Did you start the procedure with:
>     Dim X As Variant
[quoted text clipped - 17 lines]
> >> > not
> >> > hard, but i'm confused about the syntax
 
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.