Quick, simple question with Access Database Form | | |
Hello All,
I have a quick, easy question. Hopefully, someone will give me a hint.
I will greatly appreciate any help. I am pretty new to Access.
I have created a Main Menu in Form in Access. When I click on Main
Menu, an interface popups. In the interface, I have 2 buttons. For
example:
--------------------------------------------------------|
| |
| |--------------------| |
| | House Info | |
| |-------------------- |
| |
| |--------------------| |
| | Car Info | |
| |-------------------- |
|
| |
--------------------------------------------------------
What I have to do is that: when I click on button "House Info" then a
window pops up, asking for password. After that, it will go to another
interface for the user to enter/update their House information. When
someone clicks on "Car Info" button, there is no window pops up asking
for password, it just goes directly to its own interface for user to
enter information about their car.
If you have any idea how to do this, please give me a hint. Thank you
so very much for your help.
Sincerely,
Teresa | | | | re: Quick, simple question with Access Database Form
On 29 Sep 2005 17:02:18 -0700, "motessa" <leeza001@yahoo.com> wrote:
In the Click even for the HouseInfo button write:
If InputBox("Enter the password") = "secret" then
docmd.openform "EnterUpdateHouseInfo"
end if
In the click event for the other button (which you could have created
if you had used the wizard), the code would be:
docmd.openform "EnterUpdateCarInfo"
Of course you have to replace the password and form names by the
actual ones used in your app.
-Tom.
[color=blue]
>Hello All,
>
>I have a quick, easy question. Hopefully, someone will give me a hint.
>I will greatly appreciate any help. I am pretty new to Access.
>
>
>I have created a Main Menu in Form in Access. When I click on Main
>Menu, an interface popups. In the interface, I have 2 buttons. For
>example:
>
>--------------------------------------------------------|
>| |
>| |--------------------| |
>| | House Info | |
>| |-------------------- |
>| |
>| |--------------------| |
>| | Car Info | |
>| |-------------------- |
> |
>| |
>--------------------------------------------------------
>
>What I have to do is that: when I click on button "House Info" then a
>window pops up, asking for password. After that, it will go to another
>interface for the user to enter/update their House information. When
>someone clicks on "Car Info" button, there is no window pops up asking
>for password, it just goes directly to its own interface for user to
>enter information about their car.
>
>If you have any idea how to do this, please give me a hint. Thank you
>so very much for your help.
>
>Sincerely,
>Teresa[/color] | | | | re: Quick, simple question with Access Database Form
Hi Tom,
Thanks very much for your help. It gave me a wonderful tip in solving
this problem.
The only issue I have is that when the box pops up asking for password,
if I click on the "Cancel" button,
it will go directly to the next interface for the user to enter their
house information, and also if the user enters the wrong password, it
still goes directly to the next interface. Here is what I have in the
Click Event:
Private Sub Condition_Data_Setting_Click()
If InputBox("Enter the password") = "test" Then
DoCmd.OpenForm "EnterUpdateHouseInfo"
End If
On Error GoTo Err_Condition_Data_Setting_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "1-CONDITION SETTING"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Condition_Data_Setting_Click:
Exit Sub
Err_Condition_Data_Setting_Click:
MsgBox Err.Description
Resume Exit_Condition_Data_Setting_Click
End Sub
--- In my real app, the button is called : "Condition Data Setting".
I will try to change the code to make it work, if you see the reason
why, please drop me a line. Thank you so very much in answering me
question.
Sincerely,
Teresa | | | | re: Quick, simple question with Access Database Form
On 30 Sep 2005 08:33:16 -0700, "motessa" <leeza001@yahoo.com> wrote:
Perhaps this would work: ensure that all code gets executed in the
"If" condition:
Private Sub Condition_Data_Setting_Click()
On Error GoTo Err_Condition_Data_Setting_Click
Dim stDocName As String
Dim stLinkCriteria As String
If InputBox("Enter the password") = "test" Then
DoCmd.OpenForm "EnterUpdateHouseInfo"
stDocName = "1-CONDITION SETTING"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Condition_Data_Setting_Click:
Exit Sub
Err_Condition_Data_Setting_Click:
MsgBox Err.Description
Resume Exit_Condition_Data_Setting_Click
End Sub
If you want the first form to be finished before we get to the second
one, use a modal form:
DoCmd.OpenForm "EnterUpdateHouseInfo",,,,acDialog
You'll need to check the number of comma's here, but there is an
argument that allows you to specify that the form should be opened
modally. The line "stDocName = ..." won't execute until the form
closes.
-Tom.
[color=blue]
>Hi Tom,
>
>Thanks very much for your help. It gave me a wonderful tip in solving
>this problem.
>
>The only issue I have is that when the box pops up asking for password,
>if I click on the "Cancel" button,
>it will go directly to the next interface for the user to enter their
>house information, and also if the user enters the wrong password, it
>still goes directly to the next interface. Here is what I have in the
>Click Event:
>
>Private Sub Condition_Data_Setting_Click()
>
>If InputBox("Enter the password") = "test" Then
> DoCmd.OpenForm "EnterUpdateHouseInfo"
>End If
>
>On Error GoTo Err_Condition_Data_Setting_Click
> Dim stDocName As String
> Dim stLinkCriteria As String
> stDocName = "1-CONDITION SETTING"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>Exit_Condition_Data_Setting_Click:
> Exit Sub
>
>Err_Condition_Data_Setting_Click:
> MsgBox Err.Description
> Resume Exit_Condition_Data_Setting_Click
>
>End Sub
>
>--- In my real app, the button is called : "Condition Data Setting".
>I will try to change the code to make it work, if you see the reason
>why, please drop me a line. Thank you so very much in answering me
>question.
>
>Sincerely,
>Teresa[/color] | | | | re: Quick, simple question with Access Database Form
Thanks so much for your reply, Tom. I am almost finished with this. You
are a great help. I hope somebody will help you in your time of need as
much as you help me.
Sincerely,
Teresa |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|