Is there a rule of thumb for quoting variable values? For example, do I
have to put all string number values in quotes?
strAbc = "3" ?
What about long, int and byte? I assume these are NOT supposed to be quoted
lngID = 4
How about values I get from an unbound textbox?
Me!txtFs = 5 --or-- Me!txtFs = "5"
and what about when using Select Case?
Select Case Me!tabMain
Case 0
Case 1
End Select
--or--
Select Case Me!tabMain
Case "0"
Case "1"
End Select
?? 8 2007
This is an important question. You must get the data type correct for Access
to understand your query/code correctly.
For fields, do not use any delimiter for the Number or Currency type fields,
e.g.:
WHERE MyNumber = 9999
Use quote marks as delimiters around text values, e.g.:
WHERE MyText = "xxxx" OR MyText = "9999"
Use # as the delimiter around date values, e.g.
WHERE InvoiceDate = #1/4/2004#
In code, use the corrrect data type. The Value of a tab control is always an
integer, so you would use:
If Me.tabClt0 = 0 Then
You can find the data type by asking Access to give you the typename:
? TypeName(Forms! Form1!TabClt0.V alue)
Access type-casts automatically, so it often changes the types to whatever
you need without telling you. In my view, this makes it harder to learn and
understand what is going on, and frequently results in code and queries that
do not work as intended. More info and exmamples: http://allenbrowne.com/ser-45.html
Regarding your specific question about Select Case with a tab control, this
is probably best as it still works even if you reorder the pages of the tab
control, and it generates a suitable error if you remove or rename pages:
Select Case Me.TabClt0
Case Me.Page1.PageIn dex
Case Me.Pagexxx.Page Index
--
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.
"deko" <dj****@hotmail .com> wrote in message
news:EJ******** ******@newssvr2 9.news.prodigy. com... Is there a rule of thumb for quoting variable values? For example, do I have to put all string number values in quotes?
strAbc = "3" ?
What about long, int and byte? I assume these are NOT supposed to be
quoted lngID = 4
How about values I get from an unbound textbox?
Me!txtFs = 5 --or-- Me!txtFs = "5"
and what about when using Select Case?
Select Case Me!tabMain Case 0 Case 1 End Select
--or--
Select Case Me!tabMain Case "0" Case "1" End Select
??
The only time you need to use quotes is when the variables needs a string
value.
In the case of un-bound textbox, you should still follow some convention.
If the values in the un-bound text box are fact strings,a nd NOT just
numbers, then in your code, you should use quotes. The reason is that the
text box will take on whatever data type you assign to it. So, if your code
expects strings, then use quotes.
Further, when reading code.
me!SomeTextBox = "12"
or
me!SomeTextBox = 12
Both of the above will work, but as a developer reading the above code, it
is clear that the first example assumes that the text box can have all kinds
of characters, since it would be silly for the developer to use quotes when
you need a number. And, of course, the reverse is true for the 2nd value.
So, YOU get to decide if you need quotes in the above. If that control is
only supposed to have numbers, then you should not use strings, and should
not use quotes, but just use a number. What about long, int and byte? I assume these are NOT supposed to be
quoted lngID = 4
The above sounds correct to me. How about values I get from an unbound textbox?
Me!txtFs = 5 --or-- Me!txtFs = "5"
Well, in the above, you not getting values...but in fact putting in values!
However, ignoring the above minor context mistake, the notes I mention above
still apply.
and what about when using Select Case?
Select Case Me!tabMain Case 0 Case 1 End Select
Well, it depends on what type of values the tabMain expects. If you are
storing string values into tabMain, the you would use quotes. If you are
storing numbers, then you would NOT use quotes.
So, the answer will depend on what you as the designer needs to store in
that field. In the above example it does look like tabMain is a number value
from a tab control, and thus you of course would use numbers.
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada No************@ msn.com http://www.attcanada.net/~kallal.msn
hi,
i recall quite awhile back you were asking for games created with access,
if you are still curious i have a dinky horse racing game, its ok but the
odds are entirely bogus. if you want i a can upload it to a page and give
you the link - A97, but it runs fine on AXP, havent tried it on A2K.
later,
dingus
"deko" <dj****@hotmail .com> wrote in message news:<EJ******* *******@newssvr 29.news.prodigy .com>... Is there a rule of thumb for quoting variable values? For example, do I have to put all string number values in quotes?
Real simple. If it's a string value that you're assigning to a
variable, then use quotes.
Dim strWhatever As String
strWhatever = "Something"
Dim dtDate as Date
dtDate = #5/1/2004#
If the field is formatted for the variable type you're using then you
can use
strWhatever = Me!txtWhatever
Numbers - no quotes.
"deko" <dj****@hotmail .com> wrote in message news:<EJ******* *******@newssvr 29.news.prodigy .com>... Is there a rule of thumb for quoting variable values? For example, do I have to put all string number values in quotes?
Real simple. If it's a string value that you're assigning to a
variable, then use quotes.
Dim strWhatever As String
strWhatever = "Something"
Dim dtDate as Date
dtDate = #5/1/2004#
If the field is formatted for the variable type you're using then you
can use
strWhatever = Me!txtWhatever
dingusmcgee <di**********@y ahoo.com> wrote: i recall quite awhile back you were asking for games created with access, if you are still curious i have a dinky horse racing game, its ok but the odds are entirely bogus. if you want i a can upload it to a page and give you the link - A97, but it runs fine on AXP, havent tried it on A2K.
Someone else I know created Frogger game, with jumping frog and moving vehicles, and
the Tower of Hanoi puzzle.
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
In fact, every year around the Christmas holidays, I being to think my of
quest to create a VERY nice looking game of pong for ms-access. (and
multi-user to boot!). Breakout would also be good.
This year, I had way too much fun during the holidays, and did not do my
usual huge eat pizza and drink gallons of pop to write some cool code thing.
I used to love doing that during the holiday season, and this year that did
not happen!
Gee, I hope I am not getting old!
So, as it stands, thank you kindly, but nope...not looking for games just
yet, and ones that I do look for should be faithful reproductions of
classics (pong, packMan etc).
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada No************@ msn.com http://www.attcanada.net/~kallal.msn
One of my favourite gifts this year was the Atari Classic 10 games. All
of the games are embedded in a slightly oversized joystick with video
and audio outputs directly to your TV. THis is the original code. My
daughter likes Pong but my favourite is Missile COmmand. I cannot
believe that I still remember the sournds and screen colors for each
level so well from 20 years ago!
:-)
--
HTH
Stephen Lebans http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Albert D. Kallal" <pl************ ********@msn.co m> wrote in message
news:VA0Lb.1826 5$X%5.8213@pd7t w2no... In fact, every year around the Christmas holidays, I being to think my
of quest to create a VERY nice looking game of pong for ms-access. (and multi-user to boot!). Breakout would also be good.
This year, I had way too much fun during the holidays, and did not do
my usual huge eat pizza and drink gallons of pop to write some cool code
thing. I used to love doing that during the holiday season, and this year
that did not happen!
Gee, I hope I am not getting old!
So, as it stands, thank you kindly, but nope...not looking for games
just yet, and ones that I do look for should be faithful reproductions of classics (pong, packMan etc).
-- Albert D. Kallal (MVP) Edmonton, Alberta Canada No************@ msn.com http://www.attcanada.net/~kallal.msn
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Simon |
last post by:
Hi,
I have written an ActiveX object to resize images and upload them to a
database, this all works fine but when I close internet explorer the
process iexporer.exe is still running in my task manager and I can not
launch anything from the desktop (eg. a web shortcut) without firt
killing this process. The object is launched using JScript with the
following code:
var Launcher = new ActiveXObject("LaunchControl");
|
by: John Friedland |
last post by:
My problem: I need to call (from C code) an arbitrary C library
function, but I don't know until runtime what the function name is,
how many parameters are required, and what the parameters are. I can
use dlopen/whatever to convert the function name into a pointer to
that function, but actually calling it, with the right number of
parameters, isn't easy.
As far as I can see, there are only two solutions:
1) This one is portable. If...
|
by: John Henry |
last post by:
Hi list,
Just to make sure I understand this.
Since there is no "pointer" type in Python, I like to know how I do
that.
For instance, if I do:
...some_huge_list is a huge list...
|
by: Bjorn |
last post by:
Hi.
Every time i post data in a form the contents are being checked for
validity.
When i click the back-button, all data is gone and i have to retype it.
It's obvious that only a few or none of the visitors will retype it all
so i'm asking: "how to preserve POST-data when clicking the
back-button?"
i've already tried to print post data as a value in a HTML tag but
|
by: Samuel R. Neff |
last post by:
When is it appropriate to use "volatile" keyword? The docs simply
state:
"
The volatile modifier is usually used for a field that is accessed by
multiple threads without using the lock Statement (C# Reference)
statement to serialize access.
"
But when is it better to use "volatile" instead of "lock" ?
| |
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= |
last post by:
Greetings! I was researching AJAX to provide a solution to displaying status
messages while a long process executed. I found several examples online and
was able to use their code to get a quick application working. However, when
attempting to implement the solution, the AJAX calls weren't updating the
screen like the examples were and seemed not to fire until after the long
running process had completed.
I found the only real...
|
by: alfred.fazio |
last post by:
Hello everybody,
I've banged my ahead around for a while trying to figure out why
multiple instances of a class share the same instance variable. I've
stripped down my code to the following, which reproduces my problem.
class Test(object):
def __init__(self, v=):
self.values = v
|
by: raylopez99 |
last post by:
I ran afoul of this Compiler error CS1612 recently, when trying to
modify a Point, which I had made have a property. It's pointless to
do this (initially it will compile, but you'll run into problems
later). Apparently Point is a struct, a value type, and it does not
behave like a classic structure (in my mind's eye, and see below).
Traditionally I think of a classic structure as simply an object where
every member is public. But with...
|
by: tiago.private |
last post by:
Hi everybody,
Imagine the following scenario:
One System.Web.UI.UserControl (UC1) with 2 drop downs and one button
"Filter"
One Webform with (UC1) and a GridView, basically the UC1 provides the
options to the user to restrict (filter) the grid.
The user changes the drop downs and then uses the Filter button to
filter data (grid) that is the correct behavior.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |