Help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I currently have a Client form where you enter details about clients, on this
form there is a button you can press which opens an add history form.

On the add history form is a textbox called CompanyName, which I am
desparately trying to 'match' with what is entered in the CompanyName textbox
on the client form automatically. I cant seem to be able to get it to work...

Any ideas???
Thanks!
 
I currently have a Client form where you enter details about clients, on this
form there is a button you can press which opens an add history form.

On the add history form is a textbox called CompanyName, which I am
desparately trying to 'match' with what is entered in the CompanyName textbox
on the client form automatically. I cant seem to be able to get it to work...

Any ideas???
Thanks!
docmd.openForm "historyform",,,"CompanyName='" _
&Me.[CompanyName textbox] &'"

"historyform"=name of the form you want to open
"CompanyName='" _
&Me.[CompanyName textbox] &'" = filter you want to use
which field to filter = value from the control of the calling form

note: it is asuming a text control
 
THIS IS THE ONCLICK EVENT THAT ENABLES THE HISTORY FORM TO BE OPENED FROM THE
CLIENT FORM.... IN THIS CASE IS THE CODE THAT YOU PROVIDED GOING TO COPY THE
COMPANYNAME ENTERED ON THE PREVIOUS CLIENT FORM ONTO THE HISTORY
AUTOMATICALLY? - THANKS


Private Sub History_Click()
On Error GoTo Err_History_Click
If IsNull(Me![CompanyRef]) Then
MsgBox "Enter contact information before making a call."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "History"
End If

Exit_History_Click:
Exit Sub

Err_History_Click:
MsgBox Err.Description
Resume Exit_History_Click
End Sub

Andi Mayer said:
I currently have a Client form where you enter details about clients, on this
form there is a button you can press which opens an add history form.

On the add history form is a textbox called CompanyName, which I am
desparately trying to 'match' with what is entered in the CompanyName textbox
on the client form automatically. I cant seem to be able to get it to work...

Any ideas???
Thanks!
docmd.openForm "historyform",,,"CompanyName='" _
&Me.[CompanyName textbox] &'"

"historyform"=name of the form you want to open
"CompanyName='" _
&Me.[CompanyName textbox] &'" = filter you want to use
which field to filter = value from the control of the calling form

note: it is asuming a text control
 
Kerry -you'll need to link your forms to show related records. Hopefully,
you have a unique primary key in your tblCompnay (names won't do since
eventually there will be duplicates). Put the code below in the OnClick
event of the button that calls the Add History Form. It will then open that
form with only the specific record that is linked to the same record on the
main form. Try the command button wizard, and follow it through the dialogs
to select "open a form" and it will give you the option to limit records.

Dim LinkCriteria As String
DocName = "myAddHistoryForm"
LinkCriteria = "[CompanyID] = " & Me![CompanyID]
DoCmd.OpenReport DocName, A_PREVIEW, , LinkCriteria.

-Ed
 
THIS IS THE ONCLICK EVENT THAT ENABLES THE HISTORY FORM TO BE OPENED FROM THE
CLIENT FORM.... IN THIS CASE IS THE CODE THAT YOU PROVIDED GOING TO COPY THE
COMPANYNAME ENTERED ON THE PREVIOUS CLIENT FORM ONTO THE HISTORY
AUTOMATICALLY? - THANKS

Dont' shout at me (caps letters means that)
what you mean with copiing?

as a wrote: it filters the form which you open and shows records with
"CompanyName of the calling form equal
CompanyNameof the called form



Private Sub History_Click()
On Error GoTo Err_History_Click
If IsNull(Me![CompanyRef]) Then
MsgBox "Enter contact information before making a call."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "History"
End If

Exit_History_Click:
Exit Sub

Err_History_Click:
MsgBox Err.Description
Resume Exit_History_Click
End Sub

Andi Mayer said:
I currently have a Client form where you enter details about clients, on this
form there is a button you can press which opens an add history form.

On the add history form is a textbox called CompanyName, which I am
desparately trying to 'match' with what is entered in the CompanyName textbox
on the client form automatically. I cant seem to be able to get it to work...

Any ideas???
Thanks!
docmd.openForm "historyform",,,"CompanyName='" _
&Me.[CompanyName textbox] &'"

"historyform"=name of the form you want to open
"CompanyName='" _
&Me.[CompanyName textbox] &'" = filter you want to use
which field to filter = value from the control of the calling form

note: it is asuming a text control
 
Sorry!! Wasnt aware that Caps meant shouting, just needed to separate the
normal writing to the query for you.... Thank you for your help - it all now
works fantastically!

Andi Mayer said:
THIS IS THE ONCLICK EVENT THAT ENABLES THE HISTORY FORM TO BE OPENED FROM THE
CLIENT FORM.... IN THIS CASE IS THE CODE THAT YOU PROVIDED GOING TO COPY THE
COMPANYNAME ENTERED ON THE PREVIOUS CLIENT FORM ONTO THE HISTORY
AUTOMATICALLY? - THANKS

Dont' shout at me (caps letters means that)
what you mean with copiing?

as a wrote: it filters the form which you open and shows records with
"CompanyName of the calling form equal
CompanyNameof the called form



Private Sub History_Click()
On Error GoTo Err_History_Click
If IsNull(Me![CompanyRef]) Then
MsgBox "Enter contact information before making a call."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "History"
End If

Exit_History_Click:
Exit Sub

Err_History_Click:
MsgBox Err.Description
Resume Exit_History_Click
End Sub

Andi Mayer said:
On Fri, 14 Jan 2005 05:59:05 -0800, "Kerry"

I currently have a Client form where you enter details about clients, on this
form there is a button you can press which opens an add history form.

On the add history form is a textbox called CompanyName, which I am
desparately trying to 'match' with what is entered in the CompanyName textbox
on the client form automatically. I cant seem to be able to get it to work...

Any ideas???
Thanks!
docmd.openForm "historyform",,,"CompanyName='" _
&Me.[CompanyName textbox] &'"

"historyform"=name of the form you want to open
"CompanyName='" _
&Me.[CompanyName textbox] &'" = filter you want to use
which field to filter = value from the control of the calling form

note: it is asuming a text control
 
Back
Top