Solved

Access 2007 user input to drive opening a new form

Posted on 2013-01-24
3
378 Views
Last Modified: 2013-01-24
I have a start Form that has a button on it that will open up another form.

The code that is on this button that opens the second form is below.  This code works perfect.  My question is I need this button to ask the user a question after it has been clicked and place the users typed answer into a text field on the new form that it is opening.

It need to ask… “what Is todays letter”  and the user will type in l or g or z .. (a letter) any ways.. how can I ask this question after clicking the button and placing this result in “text24” of the new form that is being opened?

Thanks
____________________________
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Input_Form_with_Drop_down_box"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command20_Click:
    Exit Sub
0
Comment
Question by:FaithDan
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38814373
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Input_Form_with_Drop_down_box"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Forms![Input_Form_with_Drop_down_box].Text24 = InputBox(" what Is todays letter?")

Exit_Command20_Click:
    Exit Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:FaithDan
ID: 38814438
Thank you very much.. that worked great
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38814441
try this

Private Sub Command20_Click()
On Error GoTo Err_Command20_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
     Dim varInput
    stDocName = "Input_Form_with_Drop_down_box"
   
    varInput = InputBox("What is the letter of the day?")
    If varInput & "" <> "" Then

    DoCmd.OpenForm stDocName, , , stLinkCriteria, , , varInput
     End If
Exit_Command20_Click:
    Exit Sub


in the load event of form "Input_Form_with_Drop_down_box"

private sub form_load()

if me.openargs & ""<>"" then

    me.textbox=me.openargs
end if

end sub
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now