Too many inverted coma's (1 Viewer)

John Sh

Member
Local time
Today, 21:20
Joined
Feb 8, 2021
Messages
408
Actually the control on the form is "cboGenus". Had it been called "Genus" the line would have worked other than a possible conflict of names as the field in the table is called "Genus"
Looking at your code, I question why you chose to make this a separate, public Sub instead of within the Form's Class Module?

There is no Form being passed into it and it is clear this Sub is specially designed to work with a certain form.

I don't think it will effect performance either way but why separate the functionality unnecessarily?
That code segment, along with many others, will be re-used on other forms. I am not the best coder around so when something does as required I re-use it whenever possible. I have many forms performing different operations on the same table so re-using the code makes sense to me.
 

John Sh

Member
Local time
Today, 21:20
Joined
Feb 8, 2021
Messages
408
Code:
    rs.FindFirst "Accessionnumber ='" & str & "'" & " And Genus='" & str2 & "'"

It wasn't too many apostrophes (that is the correct name for what you call an inverted comma).
Having mulled this over a bit, you are incorrect. An apostrophe is the little dohickey that goes before the "S" in "it's".
An inverted comma, either single or double, is what goes around a quote. EG. "It wasn't too many apostrophes ";)
 

sonic8

AWF VIP
Local time
Today, 11:20
Joined
Oct 27, 2015
Messages
998
My point is that you do need to use Value in certain situations [...]
For clarification: I do not disagree with that.
My point is: Always use explicit property names for default properties whenever possible. It improves readability and reduces errors caused by ambiguous code.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:20
Joined
Jul 9, 2003
Messages
16,243
Always use explicit property names

But no-one does, and there doesn't appear to be a downside.

So my question is, are there any examples where not being explicit causes issues, or is it just about having the correct Syntax?

Looking at an extreme case, I wouldn't use explicit prefixes, as I note some programmers do...

So is it really dangerous, or personal choice?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:20
Joined
Feb 28, 2001
Messages
26,996
An inverted comma, either single or double, is what goes around a quote.

There is no inverted comma in USASCII-128, which is the default character set for Access. The character is "apostrophe" and is named as such.


Confusion often occurs when dealing with programs like Word that have "smart quotes" in which the word processor substitutes "open" or "closed" single or double quotation marks using UNICODE characters. There, the resemblance to a comma becomes obvious.

Access, not being a word processor, doesn't give a fig about them. It transparently uses apostrophe as a single-quote mark.
 

sonic8

AWF VIP
Local time
Today, 11:20
Joined
Oct 27, 2015
Messages
998
But no-one does,[...]
Great! Now I'm qualified to battle a cyclops.
So is it really dangerous, or personal choice?
So, is it really dangerous to ride a motorcycle without a helmet, or is it personal choice?
As long as you don't crash and hit your head it's not dangerous.
It's the same with writing explicit code. As long as you remember to do it, when it is mandatory, it will not cause a real problem. Nevertheless, I think it's a good practice to always wear your helmet.


@John Sh , if you're unsure when and where to put the delimiters, this tutorial video about SQL strings in VBA might be for you.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:20
Joined
Jul 9, 2003
Messages
16,243
Look, I'm NOT wearing my motorcycle helmet, when I'm programming, people look at me funny!

WearingMotorbikeHelmet.jpg


Source:-

 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:20
Joined
Feb 28, 2001
Messages
26,996
I have often thought that I could understand even the most bizarre ideas, but Uncle Gizmo, the "helmet inside the office" idea has me stumped. How much would it cost to fix the roof and how much would it cost to replace the computers damaged by falling roof pieces? How much would lost productivity cost? It would seem to me that the equation for risk/reward would not take long to make it worthwhile to fix the roof. Some people who get these crazy ideas are their own worst enemies.
 

Users who are viewing this thread

Top Bottom