Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 11th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic If...Then using variables

I am trying to make a "dynamic" If...then statement in VBA to evaluate something like: "If -1 >= 0 Then"

I have a table that contains a field that contains a string like: ">14"

So I do a Dlookup to get that value (vYellow varient) and I want to use it in an If...then like this:

If Eval(strInspType & " " & Eval(vYellow)) Then
                        MakeColorTransfomer = "Y" 'Yellow
End If

Where strInspType is a number beging past as a string.

When I run it I get this error: "The expression you entered contains invalid syntax"
When strInspType is "-1" and vYellow is "=0"

What I am attempting to do is evaluate a value (strInspType) against whatever the dlookup returns, it will ether be > or < or = to a number. strInspType is being based as a string because the field in the table does not always contain numbers, sometimes words like "none" etc. But if it is a number then I need to compair it with whatever I find in the Dlookup.
__________________
Mitch
Reply With Quote
  #2 (permalink)  
Old March 11th, 2005, 10:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This seemed to do the trick for me.

If Eval(strInspType & " " & vYellow) Then

I took out the second eval.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
quicker way to create variables in perl - dynamic? crmpicco Perl 4 March 6th, 2007 07:53 AM
Dynamic variables neo_jakey Classic ASP Professional 3 October 20th, 2005 09:12 AM
Dynamic Variables kilika VBScript 2 August 21st, 2003 11:06 AM



All times are GMT -4. The time now is 12:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.