Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old March 11th, 2005, 10:59 AM
Friend of Wrox
 
Join Date: Jun 2003
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.