Pass Form Text Input Field to Separate Form Input Field

G

Guest

I have an application that has two record types that I'll call type A and
type B in two different tables (A & B). There will only be one Type A
record, but could be NO type B records or could be MULTIPLE type B records.
I've tried building 1 single form to do data entry work for this issue, but
had no success, so I've split it to TWO forms, one builds type A records,
then gives the user a command button option to build type B records. If
button is clicked, takes user to 2nd form for type B record entry. I wanted
to save and pass key record value ##-#### from form A to form B, but the
value doesn't pass. The following is the event & code.

Form a title is Fr_CR_E Field on this form with text data I want to pass
is named
Text_Case_Num. Control Source for this field is
=[TST_FR_CASE_RECORDS.CASE_NUM] . Command button is named AddDriver with TAG
parm set to AddDriver and ON-CLICK parm set to Event Procedure as below.

Event Code is:
Private Sub AddDriver_Click()
On Error GoTo Err_AddDriver_Click

Dim strDocName As String

strDocName = "Fr_Add_Driver_E"
' Opens form Fr_Add_Driver_E in Data Entry Mode to add Drivers
' storing [Form]![FR_CR_E]![Text_Case_Num] into
' [Form]![Fr_Add_Driver_E]![CASE_NUM] to start
DoCmd.OpenForm strDocName, , , , acAdd, , Me!Text_Case_Num

' Give Other driver form control focus
Forms![Fr_Add_Driver_E]!DRIVER_NUM.SetFocus

Exit_AddDriver_Click:
Exit Sub

Err_AddDriver_Click:
MsgBox Err.Description
Resume Exit_AddDriver_Click

End Sub
----------------------
A macro exists named Fr_CR_E with the following in it:

AddDriver OpenForm Form Name Fr_Add_Driver_E
View=Form
Filter Name = null
Where Condition = null
Data Mode = Add
Window Mode = Normal.

SetValue Item [Forms]![Fr_Add_Driver_E]![CASE_NUM]
expression [Forms]![Fr_CR_E]![Text_Case_Num]

GoToControl Driver_Num

------------------------------------------------------
At this point form a Text_Case_Num has 05-010101 data in field, user clicks
AddDriver button, then secondary form appears. Form name is Fr_Add_Driver_E
appears but 1st field CASE_NUM is empty, but cursor does appear in Driver_Num
field, which is where I want the cursor. I'm just missing my CASE_NUM. Can
anyone help identify the problem.

Thanks in advance.

Robert Nusz,
DPS, State of Oklahoma


Robert Nusz @ DPS
 
J

John Vinson

I have an application that has two record types that I'll call type A and
type B in two different tables (A & B). There will only be one Type A
record, but could be NO type B records or could be MULTIPLE type B records.
I've tried building 1 single form to do data entry work for this issue, but
had no success, so I've split it to TWO forms, one builds type A records,
then gives the user a command button option to build type B records. If
button is clicked, takes user to 2nd form for type B record entry. I wanted
to save and pass key record value ##-#### from form A to form B, but the
value doesn't pass. The following is the event & code.

Um? That seems to be a very hard way to do something that a simple
Form with a Subform does with no code at all, using the Master Link
Field to pass the key record value. Have you tried and rejected this
standard approach?

John W. Vinson[MVP]
 
G

Guest

John,

Thanks for the reply. I was unable to get the Sub-Form to fit my needs, it
always showed up in a spreadsheet type of form, plus, I had to enter too many
different types of fields, (too much text, too many fields to leave it as
spread-sheet format). I could not get the code right or internal switching
right to make the sub-form appear as a secondary form, so opted for the
additional code. I've finally gotten the code to work today, doing what I
needed to do, will have to test further to insure no BUGS and when completed
will repost the code.

Thanks again for responding, have a happy holiday. Thanks for the support
too.
 
J

John Vinson

John,

Thanks for the reply. I was unable to get the Sub-Form to fit my needs, it
always showed up in a spreadsheet type of form,

You can open the Form being used as the subform and change its Default
View to "Single Form" or (my preference) "Continuous Form". The wizard
gives you datasheets by default, but you're not limited to that1


John W. Vinson[MVP]
 

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