vba - Data mismatch error 3464 -


i'm new vba i'm not sure if i'm heading in right direction. i'm using access 2010 , i've created form search id , click add new record multiple timepoints (e.g follow-up form timepoint 1, 2, 3, 4).

i have studyperiod field (long integer) select list (via query number + text). want error box come if time period has been entered.

i've been trying use code keeps coming 3464 runtime error , de-bug highlights if me. line.

what doing wrong?

private sub studyperiod_afterupdate()     dim studyperiod string     dim stlinkcriteria string      studyperiod = me.studyperiod.value     stlinkcriteria = "[studyperiod] = " & "'" & studyperiod & "'"     ' if line below returns error     if me.studyperiod = dlookup("[studyperiod]", "3_questionnaire", stlinkcriteria)         msgbox "this questionnaire has been entered participant." _             & vbcr & vbcr & "please check regid or summary table.", vbinformation, _             "duplicate information"         me.undo     end if end sub 

your studyperiod field in 3_questionnaire table numeric datatype (long integer). not include quotes before , after value of studyperiod variable when build stlinkcriteria string:

'stlinkcriteria = "[studyperiod] = " & "'" & studyperiod & "'" stlinkcriteria = "[studyperiod] = " & studyperiod if me.studyperiod = dlookup("[studyperiod]", "3_questionnaire", stlinkcriteria) 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -