Update Subform with Data from Main Form

M

mp80237

Hello, I have a database that is connected to SQL via ODBC (view Only). I
created a form that is pulling that data from the SQL so the group can see
the records. I have a subform that my group is to use to update. Most of
the time they are to grab a date [StartDate] from the form and put it in the
subform. Sometimes not, they put in a different [StartDate]. Because the
date field is in mm/dd/yyyy hh:mm:ss format (exp. 1/2/2008 2:34:25 PM) I
would like to create a button that when clicked the date gets populated in
field StartTime. Ideas?
 
J

John W. Vinson

Hello, I have a database that is connected to SQL via ODBC (view Only). I
created a form that is pulling that data from the SQL so the group can see
the records. I have a subform that my group is to use to update. Most of
the time they are to grab a date [StartDate] from the form and put it in the
subform. Sometimes not, they put in a different [StartDate]. Because the
date field is in mm/dd/yyyy hh:mm:ss format (exp. 1/2/2008 2:34:25 PM) I
would like to create a button that when clicked the date gets populated in
field StartTime. Ideas?

The format is irrelevant - a date/time value is stored as a number.

The button code would be something like

Private Sub cmdFillDate_Click()
Me![controlname] = Parent![StartDate]
End Sub

This will copy whatever value is in the parent form's StartDate control into
the control named controlname on the subform.
 

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