I have a list of patients, each of which can have multiple insurance plans. When looking at the list of patients, I want the ability to call the form to create a new insurance policy for the patients.
The member form calls the insurance form, moves to a new record. I'd like that new record to contain the member's name (or member number) from the first form.
This has got to be a common problem from order entry systems: you move from a customer form to a new order for the customer. How does the customer number get passed from the customer form to the order form?
thanks
Dante
Just use the OpenArgs argument with the open form command.
In the original form, behind a command button: - Private Sub OpenNewPolicyForm_Click()
-
If Me.Dirty Then Me.Dirty = False
-
DoCmd.OpenForm "NewPolicyForm", , , , , , Me.MemberID
-
End Sub
-
In the form to be opened: - Private Sub Form_Load()
-
If Len(Nz(Me.OpenArgs, "")) > 0 Then
-
DoCmd.GoToRecord , , acNewRec
-
Me.MemberID = Me.OpenArgs
-
End If
-
End Sub
Linq ;0)>
9 2983
Just use the OpenArgs argument with the open form command.
In the original form, behind a command button: - Private Sub OpenNewPolicyForm_Click()
-
If Me.Dirty Then Me.Dirty = False
-
DoCmd.OpenForm "NewPolicyForm", , , , , , Me.MemberID
-
End Sub
-
In the form to be opened: - Private Sub Form_Load()
-
If Len(Nz(Me.OpenArgs, "")) > 0 Then
-
DoCmd.GoToRecord , , acNewRec
-
Me.MemberID = Me.OpenArgs
-
End If
-
End Sub
Linq ;0)>
Linq,
You're my newest hero.
Thank you so much.
Dante
Glad we could help!
Linq ;0)>
Glad we could help!
Linq ;0)>
Hi,
I'm new here.. and Im also following this discussion.
I dont have much idea about programming but I do follow instruction.
Just want to know what if I what 2 values to be pass from form1 to form2.
thanks in advance... :)
Passing multiple values is a little more difficult, but doable! You don't say what you want to do with these values, so I'll just assign them to variables in the newly opened form. To assign the values, in the calling form, we'll concatenate them, placing a semi-colon between them: - Private Sub OpenFormPassing2Fields_Click()
-
If Me.Dirty Then Me.Dirty = False
-
DoCmd.OpenForm "FormToBeOpened", , , , , , Me.RecordID & ";" & Me.Rank
-
End Sub
Then, in the receiving form, we'll use the Split() function to separate the passed values and assign them to an array. We then assign the components of the array to variables. The example does this passing two values, but it could be extended to pass as many as you need to pass. - Private Sub Form_Load()
-
If Len(Nz(Me.OpenArgs, "")) > 0 Then
-
SplitArgs = Split(Me.OpenArgs, ";")
-
FirstPassedField = SplitArgs(0)
-
SecondPassedField = SplitArgs(1)
-
End If
-
End Sub
You can now use the variables as needed, keeping in mind the scope of the variables.
Welcome to Bytes!
Linq ;0)>
Hi.. Sorry for the late reply.. but I really appreciate your respond..
Thanks so much.. I got it... Im really a fan of yours.. I always end up reading your post/answer to different question.. thanks again...
znyder
Hi I have another expansion on this question I am sure you guys get once a week. I looked around quite a bit and did not see this asked anywhere. When I pass a date value It seems like openargs either crashes or sets the date to default (1899). I have tried to cast it to string and back to date a few ways but nothing seems to work. Anyone have a tip?
Well turns out a co-worker schooled me but figured id post it here for future confused people the trick is to pre-format the date :
stringhold1 = Format(dateconvert, "mm") + "/" + Format(dateconvert, "dd") + "/" + Format(dateconvert, "yyyy")
pass in argument list as :
"|" & stringhold1 & "|"
grab the value out of an open argument array and re-cast as:
newDate = DateValue(strControl2)
NeoPa 32,556
Expert Mod 16PB
Dante,
Linq has pretty well answered your question, but I'd just like to share a technique I use for data entry forms :
Instead of setting the value of any controls for a new record (which makes Access think there is a new record to create even if no other data is entered), set the .DefaultValue property of the control. This ensures the value is used if a record needs to be created, but equally allows the form to cancel the add cleanly if no data is entered.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Casey |
last post by:
Yeah, I know this question was asked by someone elselike 2 weeks ago. But I
need some additional help. I have a program I'm developing, and multiple
different forms will be opened. For now though,...
|
by: Omar Llanos |
last post by:
Recently, I posted a question on how to invoke a textbox control in Form1
(parent form) from within Form2 (which is inherited from Form1).
Someone suggested to pass a reference of the Form1 to the...
|
by: Chane |
last post by:
hi
i have doubt in how to pass values back to the called
form. I have two forms, each having a textbox and a button
control. First i'm run the first form and click the
button, it creates object...
|
by: Jason Huang |
last post by:
Hi,
In Global.cs, I have public string myString="".
Another 2 forms are Form1.cs, Form2.cs.
How do I use the Global.cs' myString to store a string in Form1 and then
pass to Form2?
Thanks for...
|
by: swb76 |
last post by:
I have a Object Oriented question.
I got two forms - Form1 and Form2. I also got two classes Class1 and
Class2
Form1 has objects Object1 - instance of Class1 and Object2 - instance
of Class2.
...
|
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= |
last post by:
I have a form, Form1, that shows an instance of Form2 when a user clicks a
button. On Form2, the user is to select items, Customer Names for example,
from a datagrid control. When the user clicks a...
|
by: Boki |
last post by:
Hi All,
I can't pass data to another form:
in form2:
private void button1_Click(object sender, EventArgs e)
{
Form1 form_copy = new Form1();
|
by: AshParr |
last post by:
Hi all,
I have 2 forms, "Form1" & "Form2", i have a button that currently
opens form2 from form1 and then hides itself:
Form2 form2 = new Form2();
form2.show;
this.Visible = False;
and...
|
by: raylopez99 |
last post by:
Keywords: scope resolution, passing classes between parent and child
forms, parameter constructor method, normal constructor, default
constructor, forward reference, sharing classes between forms....
|
by: =?Utf-8?B?Unlhbg==?= |
last post by:
I am trying to pass a value from a texbox in Form1 to a textbox in Form2
using properties in VS2005 but it doesn't work; please help (project is
attached).
Code for Game Class:
using System;...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |