Subform VBA Code

m82palmer

New member
Local time
Today, 02:15
Joined
Apr 16, 2004
Messages
9
First off im not 100% sure if this is the right place, as its too do with Forms and VBA, so sorry if its in the wrong place.

I have a form (Dispatch) with a subform on it (Dispatch - Sub(Status)).

The "Dispatch" form has searchable data, whist the "Dispatch - Sub(Status)" subform is a data input form.

Would someone mind telling me how to code it so, when i Press "CMD_Button_do" it copys the data in Text_box_1 on the Dispatch form, to Text_box_2 on the Dispatch - Sub(Status) subform?



Code:
Private Sub CMD_Button_do_Click()

(data from "Text_box_2" on "Dispatch - Sub(Status)" form) = (data from "Text_box_1" on "Dispatch" form)

End Sub

If you can help i would most apreciate it as currently its sending me insaine :(

cheers

michael
 
If CMD_Button_do is on the main form, try:

Me![Dispatch - Sub(Status)].Form![Text_box_2] = Text_box_1

Or if CMD_Button_do is on the subform, try:

Text_box_2 = Me.Parent![Text_box_1]

I strongly suggest a name change for your subform: the current subform name can be interpretted by Access as a vb expression.

hth,

Doug.
 
Last edited:
Thank you very much, it work a treat :D

Ive also taken your advise an renamed my subform.

Thanks once again

Michael
 

Users who are viewing this thread

Back
Top Bottom