Re: Regarding StlinkCriteria / String Variable



Jean,

I see a couple of issues with how you are approaching this.

1) You can only use the 'Me' keyword when you are using
code behind a form unless you pass it as a parameter to
another routine. A true Global variable is declared in a
Global module, not a form module.

2) The value of your ContactID is not going to be a string
if the use of 'st' is designating a string or text variable
for your global. Therefore your "[ContactID] = " will bomb
if you hand it a string value as the ID is probably looking
for a long integer.

3) I can't see any reason to use a Global variable for what
I think that you are trying to do. ( I have been wrong
before ).

Your code at the bottom of your post looks like what has
been generated by a wizard for an OpenForm or OpenReport
command in a form's code module. If that is the case just
modify the last line to directly pull the value of the ID
off of the form and forget about trying to use another
variable...

stLinkCriteria = "[ContactID] = " & Me![Course Admin
ContactID]


Gary Miller
Sisters, OR



"Jean" <jean@xxxxxxx> wrote in message
news:ezjvmpbBGHA.628@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I am using MS ACCESS 2002 on Windows 2000. I want to know
> how to pass the
> value of the global variable as part of the argument for
> stLinkCriteria that
> specify the actual field data.
>
> ''''''' Global Variable''''''''
> stWhichContact = "Me![Course Admin ContactID]"
>
> stLinkCriteria = "[ContactID]=" & stWhichContact
>
> How do I code the above line so, the stLinkCriteria will
> return the actual
> field value of Me![Course Admin ContactID] ?
>
> I want
> stLinkCriteria = "[ContactID] = 2"
> instead of
> stLinkCriteria = "[ContactID] = Me![Course Admin
> ContactID]"
>
> Thanks,
>
> Jean
>
>


.



Relevant Pages

  • Re: Auto fill existing record, allow new entry
    ... A string is text, as opposed to number, date, yes/no, and a few others. ... The expression you are using for After Update in Combo25 is looking for a record in which ContactID matches the bound column of Combo25, ... You mentioned the text box row source. ...
    (microsoft.public.access.forms)
  • Kinda new and having trouble with SQL stored procedure
    ... private static string ConnectionString ... protected static void AddParamToSQLCmd(SqlCommand sqlCmd, ... ParameterDirection.Input, contactId); ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Full Text Search across multiple tables (Parent-Child)
    ... select contactid from contact_role where contactid in (select key from ... containstable(contact,name,'search string') or roleid in (select key ... > Is is possible to search across multiple tables (Parent-Child)? ... > doesn't work when I search for multiple terms ie. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Problem adding a subform record
    ... assuming there is a ContactID control in the form, ... This approach does not require a RowSource declared in the form's design. ... Dim strPhone As String, strSQL As String ...
    (microsoft.public.access.forms)