Maurita,
? ?Assuming your going from Main form to Main form, and both forms are open.
? ?(You did not indicate what fields you were going to on the second form)
? ?Private Sub Command119_Click
? ? ? ? Forms![Personal Habits-Form]![SomeFieldName] = Forms![Patient
History-Form]![DateSFESigned]
? ? ? ? Forms![Personal Habits-Form]![SomeFieldName] = Forms![Patient
History-Form]![Combo91]
? ? ? ? Refresh ? 'optional
? ?End Sub
? ?Suggestion: You should avoid spaces in your object names (frmPersonalHabits instead
of
[Personal Habits-Form])
and use names that are meaningful (cboSelectItem instead of Combo91) ?Object names
with no
spaces don't require bracketing, and meaningful names will help you read and
understand
your code.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVPhttp://home.comcast.net/~cccsolutions
"Find a job that you love, and you'll never work a day in your life."
Hi, hope someone can help with passing two values from one form to
another by way of a command button. ?I have spent a week on various
code taken from this site, but still no luck. ?Please ... someone help!!
The form I am passing values from is called PATIENT HISTORY-Form. ?On
this form, I need to pass a date from a field called DateSFESigned and
I also need to pass information collected from a Combo box, Combo91.
The command button is called Command119.
The form that the values are being passed to is called Personal Habits-
Form.
Thank you in advance for any help on this matter.
MauritaSearcy- Hide quoted text -
- Show quoted text -
Thank you so much for your help. I will work on your suggestions and
let you know how it works. Again, thanks.- Hide quoted text -
Thank you again for your help but I have a problem. For some reason,
I keep getting an error "Switchboard can't find the form", but the
form is in the database and I checked to be sure it is workable, which
it is. What do you suggest. My code is as follows:
Private Sub Command114_Click()
Forms![frmPersonalHabits]![PHDate] = Forms![frmPatientHistory]!
[DateSFESigned]
Forms![frmPersonalHabits]![Combo91] = Forms![frmPatientHistory]!
[Combo91]
Refresh
End Sub
Thank you.
MauritaSearcy
-------------------------------Maurita,
From my first post...>Assuming your going from Main form to Main form, and both forms are open.
Both forms need to be open at the time this code runs, and you shouldbe on
frmPatientHistory when it fires... and having just entered values in bothcontrols.
If those forms aren't open, and your not on the specific record you want to copy the
values from, how would Access know what record, and what values in the History
recordset... to transfer to Habits?
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVPhttp://home.comcast.net/~cccsolutions
"Find a job that you love, and you'll never work a day in your life."- Hide quoted text -
- Show quoted text -