copy text/value

H

hsdaguilar

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.
 
O

Ofer

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
 
H

hsdaguilar

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

Ofer said:
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


hsdaguilar said:
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.
 
O

Ofer

Can you post what you have already.



hsdaguilar said:
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

Ofer said:
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


hsdaguilar said:
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.
 
H

hsdaguilar

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. :)

Ofer said:
Can you post what you have already.



hsdaguilar said:
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

Ofer said:
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.
 
O

Ofer

Let start from here

Private Sub Command16_Click()

If IsNull(DLookup("AddressNameInTable", "TableName", "[Address]='" &
Me.txtAddress & "' And [Street]='" & Me.cboStreet & "'")) Then
' No records
If MsgBox("No Record, would you like to add one?", vbOKCancel) = vbOK Then
DoCmd.OpenForm "frmPrimary", , , , acFormAdd ' In insert mode
Else
Exit Sub
End If
Else ' Found record
DoCmd.OpenForm "frmPrimary", , , "[Address]='" & Me.txtAddress & "' And
[Street]='" & Me.cboStreet & "'"
End If

End Sub
On the on load event of the second form write the code
Me.AddressFieldname = Forms![NameOfFirstForm]![txtAddress]
Me.StreetFieldname = Forms![NameOfFirstForm]![cboStreet]

' The second form need to be bounded to the right table
hsdaguilar said:
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. :)

Ofer said:
Can you post what you have already.



hsdaguilar said:
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.
 
H

hsdaguilar

Worked Perfect! Ready for next part.

p.s
Once again, thank you for your assistance. :)

Ofer said:
Let start from here

Private Sub Command16_Click()

If IsNull(DLookup("AddressNameInTable", "TableName", "[Address]='" &
Me.txtAddress & "' And [Street]='" & Me.cboStreet & "'")) Then
' No records
If MsgBox("No Record, would you like to add one?", vbOKCancel) = vbOK Then
DoCmd.OpenForm "frmPrimary", , , , acFormAdd ' In insert mode
Else
Exit Sub
End If
Else ' Found record
DoCmd.OpenForm "frmPrimary", , , "[Address]='" & Me.txtAddress & "' And
[Street]='" & Me.cboStreet & "'"
End If

End Sub
On the on load event of the second form write the code
Me.AddressFieldname = Forms![NameOfFirstForm]![txtAddress]
Me.StreetFieldname = Forms![NameOfFirstForm]![cboStreet]

' The second form need to be bounded to the right table
hsdaguilar said:
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. :)

Ofer said:
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.
 
O

Ofer

Good luck with your project

hsdaguilar said:
Worked Perfect! Ready for next part.

p.s
Once again, thank you for your assistance. :)

Ofer said:
Let start from here

Private Sub Command16_Click()

If IsNull(DLookup("AddressNameInTable", "TableName", "[Address]='" &
Me.txtAddress & "' And [Street]='" & Me.cboStreet & "'")) Then
' No records
If MsgBox("No Record, would you like to add one?", vbOKCancel) = vbOK Then
DoCmd.OpenForm "frmPrimary", , , , acFormAdd ' In insert mode
Else
Exit Sub
End If
Else ' Found record
DoCmd.OpenForm "frmPrimary", , , "[Address]='" & Me.txtAddress & "' And
[Street]='" & Me.cboStreet & "'"
End If

End Sub
On the on load event of the second form write the code
Me.AddressFieldname = Forms![NameOfFirstForm]![txtAddress]
Me.StreetFieldname = Forms![NameOfFirstForm]![cboStreet]

' The second form need to be bounded to the right table
hsdaguilar said:
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.
 

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