Including a underscore in a string: Desparately need help!

T

Tom

I have this app which includes a feature, when clicked on, fires the
corresponding access form containing table data for that feature. (see
code below). It works great, when the variable being passed
(thestring) is all text, or all number. Unfortunately, the form field
that I need to filter on is some_thing. This returns a blank form.
Removing the underscore from the access DB (with 100 linked tables and
40 relationships using "some_thing") is not an option (given that it
was made by a govt agency, and would require months of meetings). So,
any ideas on how I can split "thestring" up to include that
underscore? THanks for your help!




Sub Hyperlink2(pLink, pLayer)
'this is the code for layers that hyperlink to a graphic
On Error GoTo eh:

Dim pHyperlink As IHyperlink
Set pHyperlink = pLink
Dim pFLayer As IFeatureLayer
Set pFLayer = pLayer
Dim thestring As String
thestring = pHyperlink.Link

Dim hwnd
Dim StartDoc
hwnd = apiFindWindow("OPUSAPP", "0")

'opens Microsoft Access database
StartDoc = ShellExecute(hwnd, "open", "C:\ASMIS200\asmis.mdb", "",
"c:\", SW_SHOWNORMAL)

Dim Accapp As Access.Application
Set Accapp = GetObject("C:\ASMIS200\asmis.mdb")


Accapp.DoCmd.OpenForm "ASMIS_MAIN_EDIT_SUMMARY", acNormal, ,
("[some_thing]=" & Chr(34) & thestring & Chr(34))

Exit Sub

eh:
MsgBox "Something isn't working!"

End Sub
 
M

MacDermott

This is just a guess, but I don't think that it's the underscore that's
making the problem.
I'm not sure what you have in mind, either, in splitting "thestring" up.

I do think that your code might fail if there is a double-quote in the value
of thestring.

If you're convinced that the underscore is the problem, I'd suggest that you
take a small subset of your database and try removing it.

HTH
- Turtle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top