Solved Records with a Dash don't display (1 Viewer)

NearImpossible

Registered User.
Local time
Today, 03:36
Joined
Jul 12, 2019
Messages
225
I have this database that i've been work with for a few years now and it has grown into a beast thanks to help from several of you, but now I am running into an issue I haven't come across yet.

Basically most of the database is filterable by a Facility Name, however today I encountered our first Facility with a dash in its name, i.e. Facility-Name and when I open a form filtered on the Facility Name, it is blank.

I did a test and removed the dash from the name and it then populated the form, so my question is, how can I make this work with the dash in the name as it is required to be there?

Please advise

thank you
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:36
Joined
Oct 29, 2018
Messages
21,447
How exactly are you filtering the form?
 

NearImpossible

Registered User.
Local time
Today, 03:36
Joined
Jul 12, 2019
Messages
225
Code:
DoCmd.OpenForm "FacilitySetupChecklist", , , "[Facility Name]= '" & Me![Facility Name] & "'"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:36
Joined
Oct 29, 2018
Messages
21,447
Code:
DoCmd.OpenForm "FacilitySetupChecklist", , , "[Facility Name]= '" & Me![Facility Name] & "'"
What happens if you do it this way?
Code:
DoCmd.OpenForm "FacilitySetupChecklist", , , "[Facility Name]='Facility-Name'"
 

NearImpossible

Registered User.
Local time
Today, 03:36
Joined
Jul 12, 2019
Messages
225
What happens if you do it this way?
Code:
DoCmd.OpenForm "FacilitySetupChecklist", , , "[Facility Name]='Facility-Name'"

are you saying to type in the actual facility name after the = ?

If so, that did bring up the record
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 01:36
Joined
Oct 29, 2018
Messages
21,447
are you saying to type in the actual facility name after the = ?

If so, that did bring up the record
Okay, if that worked, then the problem probably had nothing to do with the dash character. It must have something to do with your form's data (you know, whatever is in Me![Facility Name]).
 

NearImpossible

Registered User.
Local time
Today, 03:36
Joined
Jul 12, 2019
Messages
225
Okay, if that worked, then the problem probably had nothing to do with the dash character. It must have something to do with your form's data (you know, whatever is in Me![Facility Name]).

not sure, but changed the code back to the original and its working with all facilities, dash or not, gotta love DBs....
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:36
Joined
Oct 29, 2018
Messages
21,447
not sure, but changed the code back to the original and its working with all facilities, dash or not, gotta love DBs....
Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom