Need extra quote marks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone. Using A02 on XP. Opening a form using the current form's field
[TPA Contact ID] and opening form "TPA-Address-Form" that has the field
[TPA-ContactID].

Grabbed my wordage below to use it but remembered it was a text field and
these are both number fields and they require more quotation marks.

Can someone help? I know it's simple. Just need extra quotes.

Also wasn't sure if I had the fields in the right position. Don't know the
translation of the line stLinkCriteria = "[TPA-ContactID]=" & "'" &
Me![TPA Contact ID] & "'" Which one is the current form field and which one
is the 'form to be opened' field?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"

stLinkCriteria = "[TPA-ContactID]=" & "'" & Me![TPA Contact ID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Thank you to each and everyone of you that takes the time to help others
learn.
 
Bonnie A said:
Hi everyone. Using A02 on XP. Opening a form using the current
form's field [TPA Contact ID] and opening form "TPA-Address-Form"
that has the field [TPA-ContactID].

Grabbed my wordage below to use it but remembered it was a text field
and these are both number fields and they require more quotation
marks.

Can someone help? I know it's simple. Just need extra quotes.

Also wasn't sure if I had the fields in the right position. Don't
know the translation of the line stLinkCriteria =
"[TPA-ContactID]=" & "'" & Me![TPA Contact ID] & "'" Which one is
the current form field and which one is the 'form to be opened' field?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"

stLinkCriteria = "[TPA-ContactID]=" & "'" & Me![TPA Contact ID] &
"'" DoCmd.OpenForm stDocName, , , stLinkCriteria

Thank you to each and everyone of you that takes the time to help
others learn.

It looks to me like you've got the field names right, but you don't need
the quotes around a numeric field. Try this:

stLinkCriteria = "[TPA-ContactID]=" & Me![TPA Contact ID]
 
If TPA-ContactID is a numeric field, the string should be:

stLinkCriteria = "[TPA-ContactID]=" & Me![TPA Contact ID]

In the above, [TPA-ContactID] is the field name and Me![TPA Contact ID] is
the name of the control on the form that holds the value you want to match
to the field.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Dirk, you are right on time! I kept trying to figure out the quotes and I
had it BACKWARDS! It works beautifully. Thank you for taking the time to
help. I really appreciate it.

Thanks again!
--
Bonnie W. Anderson
Cincinnati, OH


Dirk Goldgar said:
Bonnie A said:
Hi everyone. Using A02 on XP. Opening a form using the current
form's field [TPA Contact ID] and opening form "TPA-Address-Form"
that has the field [TPA-ContactID].

Grabbed my wordage below to use it but remembered it was a text field
and these are both number fields and they require more quotation
marks.

Can someone help? I know it's simple. Just need extra quotes.

Also wasn't sure if I had the fields in the right position. Don't
know the translation of the line stLinkCriteria =
"[TPA-ContactID]=" & "'" & Me![TPA Contact ID] & "'" Which one is
the current form field and which one is the 'form to be opened' field?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"

stLinkCriteria = "[TPA-ContactID]=" & "'" & Me![TPA Contact ID] &
"'" DoCmd.OpenForm stDocName, , , stLinkCriteria

Thank you to each and everyone of you that takes the time to help
others learn.

It looks to me like you've got the field names right, but you don't need
the quotes around a numeric field. Try this:

stLinkCriteria = "[TPA-ContactID]=" & Me![TPA Contact ID]

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Hi Roger,

Thank you very much for the 'fix' and explanation. It works!

--
Bonnie W. Anderson
Cincinnati, OH


Roger Carlson said:
If TPA-ContactID is a numeric field, the string should be:

stLinkCriteria = "[TPA-ContactID]=" & Me![TPA Contact ID]

In the above, [TPA-ContactID] is the field name and Me![TPA Contact ID] is
the name of the control on the form that holds the value you want to match
to the field.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



Bonnie A said:
Hi everyone. Using A02 on XP. Opening a form using the current form's field
[TPA Contact ID] and opening form "TPA-Address-Form" that has the field
[TPA-ContactID].

Grabbed my wordage below to use it but remembered it was a text field and
these are both number fields and they require more quotation marks.

Can someone help? I know it's simple. Just need extra quotes.

Also wasn't sure if I had the fields in the right position. Don't know the
translation of the line stLinkCriteria = "[TPA-ContactID]=" & "'" &
Me![TPA Contact ID] & "'" Which one is the current form field and which one
is the 'form to be opened' field?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"

stLinkCriteria = "[TPA-ContactID]=" & "'" & Me![TPA Contact ID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Thank you to each and everyone of you that takes the time to help others
learn.
 
Back
Top