Make 2nd SF Locked or Invisible if Linked Field Not Populated

G

Guest

Hi Guys. Got a tough one. I have a main form that has two subforms (SF1 and SF2) that are linked together with IDClientNo (autonumber). When info is inputted to SF1, user can then add further clarifying data into SF2. I have IDClientNo displayed on both SF1 and SF2 for testing purposes. When user enters data into SF1, the IDClientNo autonumber turns into a valid numeric charcter and is displayed on SF1. It is not displayed on the open SF2 until SF2 gets the focus and the user tries to add data to SF2. As soon as you click a checkbox in SF2 or enter text into SF2, the IDClientNo populates through the link. This works well. No Problem. The problem occurs when SF2 is visible and the user clicks the AddRecord button on SF1 and without entering any data on SF1 (all fields are blank and the autonumber has not turned into a numeric character), trys to enter data into the blank SF2 where the linked autonumber has not been populated (due to no data being entered into SF1). Of course an error message appears. I hope I am making sense. I am trying to get it so that under this condition, SF2 is either locked or made not visible. If locked, and the user tries to enter data into SF2 with no data in SF1, then a MsgBox would appear. I've tried everything. Below is a sample of the code I am trying but I don't know if I shoudl put the code on SF1, SF2 or both and I am not sure what event should trigger it. Thanks for any help

SF2 On_Curren
'SF2 named ClientBio. Main Form Named Clients
Dim strHold As Strin
If Me.CurrentRecord And Not IsNumeric(Me.[IDClientNo]) The
Forms!Clients.ClientBio.Visible = Fals
Els
Forms!Clients.ClientBio.Visible = Tru
End I
 

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