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

Lost Focus.. basic confusion

P: 5
Basically im an amature at this stuff as ive just started, and teacher thinks we are all young Bill Gates.

I have a main form of Examiner Details and a subform with other details. I want 1 thing in the subform to be the same as in the main form, if not displaying a message. So im not sure how to set this out... I gave this a go

Private Sub ScriptID_LostFocus()

'ScriptID must equal SubRefcode2'
If ([ScriptID] <> [SubRefCode2]) Then
MsgBox "Script ID wrong"

End If
End Sub

---------------
But nothing happens.... do i need to state the location of the fields, if so could you please post how i will succeed in doing this..
Thankyou
Mar 19 '07 #1
Share this Question
Share on Google+
2 Replies


balid
P: 18
Basically im an amature at this stuff as ive just started, and teacher thinks we are all young Bill Gates.

I have a main form of Examiner Details and a subform with other details. I want 1 thing in the subform to be the same as in the main form, if not displaying a message. So im not sure how to set this out... I gave this a go

Private Sub ScriptID_LostFocus()

'ScriptID must equal SubRefcode2'
If ([ScriptID] <> [SubRefCode2]) Then
MsgBox "Script ID wrong"

End If
End Sub

---------------
But nothing happens.... do i need to state the location of the fields, if so could you please post how i will succeed in doing this..
Thankyou
If SubRefcode2 is not on the same form as ScriptID then you will need to reference the form it is on. How are you storing the values on your subform? Are you using a listbox or an array?
Mar 19 '07 #2

100+
P: 149
Basically im an amature at this stuff as ive just started, and teacher thinks we are all young Bill Gates.

I have a main form of Examiner Details and a subform with other details. I want 1 thing in the subform to be the same as in the main form, if not displaying a message. So im not sure how to set this out... I gave this a go

Private Sub ScriptID_LostFocus()

'ScriptID must equal SubRefcode2'
If ([ScriptID] <> [SubRefCode2]) Then
MsgBox "Script ID wrong"

End If
End Sub

---------------
But nothing happens.... do i need to state the location of the fields, if so could you please post how i will succeed in doing this..
Thankyou

How are you calling this sub ScriptID_LostFocus(). Is it called on some event or just when the subform loads up??

thanks
ansuman sahu
Mar 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.