This is all I have so far...
On Click on an "OK" button in frmQuery.
Private Sub Command16_Click()
DoCmd.OpenForm "frmPrimary",, "qryPlanningQuery"
I need code to tell it to show a message only if there is no record. And I
need code to tell it to fill in the address and street fields in frmPrimary
with what was entered in frmQuery if the msg button yes is clicked.
I hope you can help.
Thank you.
:
Can you post what you have already.
:
Thank you Ofer. But it seems like I need more help now and I would be happy
for any assitance you can provide.
I was using a macro open the form based on the value inputted in frmQuery.
And if there was no record it would pop out the message. However, I am now
trying to convert to code instead of macro and I can't seem to get it right.
Ok, so this is what I have:
1. frmQuery has two fields. txtAddress and cboStreet.
2. frmPrimary has many fields, including Address and Street.
3. qryPrimaryQuery, used as a filter.
And this is what I want to do:
1. Input an address and street in frmQuery.
2. If there is a record match in frmPrimary it opens to that (those)
record(s).
I have figured up to here already.
3. If there is no match, then a messagebox pops up saying, "No Record, would
you like to add one?" with a yes and no option.
4. If they click yes, then the address and street that they originally
inputted in frmQuery would go in the corresponding fields in frmPrimary.
If there is a match or if they click no, then the info inputted into
frmQuery can just be deleted...
Thank you.
1. In
:
If you open FrmPrimary form after the message then on the on load event of
the FrmPrimary form you can write he code
Me.Field1 = Forms![frmQuery]![Field1]
Me.Field2 = Forms![frmQuery]![Field2]
Me.Field3 = Forms![frmQuery]![Field3]
=========================================
You can save the values of the field in global variables, and then assign
this variables to the fields in FrmPrimary.
=========================================
You can send all the values with the open args, with a separator, and then
use the split function to get each value.
e.g : OpenArgs = Field1-Field2-Field3
Me.Field1 = Split(me.OpenArgs,"-")(0)
Me.Field2 = Split(me.OpenArgs,"-")(1)
=========================================
Mybe if youll specify the way you handle the forms to add records, we will
be able to help more
:
I use a form (frmQuery) to query my Primary form (frmPrimary).
I currently have it so that if there is no match a message pops up asking if
you would like to add a new record.
I would like for it to automatically copy the text/value entered in the
frmQuery fields and paste it onto the corresponding fields in frmPrimary
after the person selects "yes" on the message box.
Any assistance would be greatly appreciated.