First some background info about me:
Being a physician I do not have any background in programming language. All I know about access is through a basic database design class I took in med school and online google searches.
I am working on a database which will ask a few questions per screen to patients. I want them to answer each question on the form before proceeding to the next screen (the next form in this case). For e.g. in the attached sample database I have two forms "demographics" and "past medical history".
study participants will be presented with the "demographics" form at the beginning. The idea is to have them answer all questions before proceeding to the next screen/form. All the fields in the form have been set to required (by editing the table properties). I created a button at the end of the form with 2 on_click events. When the button is pressed, it will open a new form and close the current form (after auto saving). My problem is that if participants click on the button directly (without filling out the details) it would still take them to the next screen/form
So I searched around and there is the "AfterUpdate" argument in VB where I can disable the button if the particular value of that field is null. I used the following code
The problem with this type of arrangement is that even if a single condition is met (for e.g. only first name is entered and not last name), the button is enabled. What would be a good workaround for this?
The code that I am currently using is for string variable. What should the code look like if I have numeric variables? or an option box?
I read somewhere on this forum about setting up a command button toggle. I have no idea how to do it and how it works. Can anyone help me please? I would really appreciate any help.
I'm attaching a short demo of my database. It is in access 2007 format- had to zip it due to file size.
Being a physician I do not have any background in programming language. All I know about access is through a basic database design class I took in med school and online google searches.
I am working on a database which will ask a few questions per screen to patients. I want them to answer each question on the form before proceeding to the next screen (the next form in this case). For e.g. in the attached sample database I have two forms "demographics" and "past medical history".
study participants will be presented with the "demographics" form at the beginning. The idea is to have them answer all questions before proceeding to the next screen/form. All the fields in the form have been set to required (by editing the table properties). I created a button at the end of the form with 2 on_click events. When the button is pressed, it will open a new form and close the current form (after auto saving). My problem is that if participants click on the button directly (without filling out the details) it would still take them to the next screen/form
So I searched around and there is the "AfterUpdate" argument in VB where I can disable the button if the particular value of that field is null. I used the following code
Code:
Private Sub First_Name_AfterUpdate()
If Me.First_Name = "" Then
Me.Demo_next.Enabled = False
Else
Me.Demo_next.Enabled = True
End If
End Sub
Private Sub last_Name_AfterUpdate()
If Me.Last_Name = "" Then
Me.Demo_next.Enabled = False
Else
Me.Demo_next.Enabled = True
End If
End Sub
The problem with this type of arrangement is that even if a single condition is met (for e.g. only first name is entered and not last name), the button is enabled. What would be a good workaround for this?
The code that I am currently using is for string variable. What should the code look like if I have numeric variables? or an option box?
I read somewhere on this forum about setting up a command button toggle. I have no idea how to do it and how it works. Can anyone help me please? I would really appreciate any help.
I'm attaching a short demo of my database. It is in access 2007 format- had to zip it due to file size.
Attachments
Last edited: