By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

Argument not optional error in VB module

P: n/a
Hi

I have an after update event on a field on my people form.

When i try to debug the code i get an "Argument not optional" error in
relation to the IIf statement.

I used the same code in an update query and it worked perfectly.

PE_Initials = (Left([PE_First_Name], 1) & IIf(InStr(1, [PE_First_Name],
" ") <> 0, Mid([PE_First_Name], InStr(1, [PE_First_Name], " "), 2)))

Can anyone tell me why this doesn't work in the code module.

Thanks

Gillian

Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Gilz" <gd*****@tlpsystems.co.uk> wrote in
news:11*********************@i40g2000cwc.googlegro ups.com:
Hi

I have an after update event on a field on my people form.

When i try to debug the code i get an "Argument not optional"
error in relation to the IIf statement.

I used the same code in an update query and it worked
perfectly.
You didn't. :-) You think you did, but you copied it wrong.
PE_Initials = (Left([PE_First_Name], 1) & IIf(InStr(1,
[PE_First_Name], " ") <> 0, Mid([PE_First_Name], InStr(1,
[PE_First_Name], " "), 2)))

Can anyone tell me why this doesn't work in the code module.

Thanks

Gillian

PE_Initials = (Left([PE_First_Name], 1) _
& IIf(InStr(1, [PE_First_Name], " ") <> 0, _
Mid([PE_First_Name], _

above is good. Below is nonsense to Access

InStr(1, [PE_First_Name], " "), 2)))

--
Bob Quintal

PA is y I've altered my email address.
Apr 24 '06 #2

P: n/a
Hi

Thanks for that Bob but i have double checked the query and that is the
correct string and it works perfectly to give me the second initial is
the field person name has two words in the query.

I am running access 2000 but the code definately works in my update
query.

Gillian

Apr 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.