invalid use of ./!/parenthesis

G

Guest

Hi,

I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one line of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
A

Allen Browne

Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)
 
G

Guest

Hi Andrew,
try in this way
Me![Document Number] = Me![Department Number] & "INV" & tmp

HTH Paolo
 
G

Guest

I still get the same error

--
Thank you




Paolo said:
Hi Andrew,
try in this way
Me![Document Number] = Me![Department Number] & "INV" & tmp

HTH Paolo

andrew3254 said:
Hi,

I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one line of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
G

Guest

I still get the same error
--
Thank you




Allen Browne said:
Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

andrew3254 said:
I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one line
of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
A

Allen Browne

Remove the single quote from the Debug.Print line.
When it fails, press Ctrl+G to see what printed there.

That should help you identify your mistake, such as using the value of the
Department Number field instead of the name itself, or refering to a null
value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

andrew3254 said:
I still get the same error
--
Thank you




Allen Browne said:
Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)

andrew3254 said:
I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one
line
of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
G

Guest

It now shows a different error

Cant find the field "143INV0001" referred to in your expression.

Surely it would just take the value from strCtlName.
--
Thank you




Allen Browne said:
Remove the single quote from the Debug.Print line.
When it fails, press Ctrl+G to see what printed there.

That should help you identify your mistake, such as using the value of the
Department Number field instead of the name itself, or refering to a null
value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

andrew3254 said:
I still get the same error
--
Thank you




Allen Browne said:
Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)


I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one
line
of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
G

Guest

I changed Me.[Document Number] = Me(strCtlName)

to

Me.[Document Number] = strCtlName

and that has fixed it.

Thank you for your time, much appreciated.





Allen Browne said:
Remove the single quote from the Debug.Print line.
When it fails, press Ctrl+G to see what printed there.

That should help you identify your mistake, such as using the value of the
Department Number field instead of the name itself, or refering to a null
value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

andrew3254 said:
I still get the same error
--
Thank you




Allen Browne said:
Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)


I am probs missing something small but cant see it for looking and been
staring at it for far too long, I'm getting an error message for one
line
of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line in
another module with exactly the same syntax and that works perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 
A

Allen Browne

Do you have a control named 143INV0001 on your form?

That's what you've asked it for.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

andrew3254 said:
It now shows a different error

Cant find the field "143INV0001" referred to in your expression.

Surely it would just take the value from strCtlName.
--
Thank you

Allen Browne said:
Remove the single quote from the Debug.Print line.
When it fails, press Ctrl+G to see what printed there.

That should help you identify your mistake, such as using the value of
the
Department Number field instead of the name itself, or refering to a null
value.

andrew3254 said:
I still get the same error
--

:

Try this approach:
Dim strCtlName As String
strCtlName = Me.[Department Number] & "INV" & tmp
'Debug.Print strCtlName
Me.[Document Number] = Me(strCtlName)


I am probs missing something small but cant see it for looking and
been
staring at it for far too long, I'm getting an error message for one
line
of
code saying:

Error "2447"

Invalid use of .(dot) or ! operator or invalid parenthesis.

I cant seem to find the error with it as it matches a similar line
in
another module with exactly the same syntax and that works
perfectly.

Line of code:
Me.[Document Number] = Me.[Department Number] & "INV" & tmp

tmp being a number value created before this statement.
 

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

Top