Procedure Declaration Error

G

Guest

I am trying to assign a value to a control that is the same as the value of
a control in another form. The goal would be to enter the contact
information on the Reservation form, click the button, and the Reservation
Detail form comes up to enter the details of the reservation. That detail
information then appears on a subform on the Reservation form. I would like
to have the CustomerID value from the Reservation Form be assigned to the
CustomerID on the Reservations Detail form. I have built a macro on a
command button to open the form (which works) and to set the value (which
doesn't). The fields are of the same data type and format. As soon as I
click the button, the form appears, but a message appears that says:
"Procedure declaration does not match description of event or procedure
having the same name".

The macro is set for OnClick and reads:

Echo
Echo On NO
OpenForm
Form Name Reservation Detail
View Form
Data Mode Add
Window Mode Normal
SetValue
Item [Forms]![Reservation Detail]![CustomerID]
Expression [Forms]![Reservation]![CustomerID]

I have been trying to tweak this for two days to no avail. Any assistance
you could offer would be appreciated.





Miranda
 
G

Guest

Hi

Miranda

You need 2 macros.

Open that will run from your new button on form 1. This will simply open
forms.
The other macro is set to run on the OnLoad event of form 2. This sets the
value of CustomerID in form 2 to the value of the CustomerID in form 1.

Hope this helps

Oh it would be better to run it from code. So....

On form 1
The OnClick event of the button would be something like this (change
buttonName to what it is on your form)

Private Sub ButtonName_Click()
DoCmd.OpenForm "Reservations_Detail_form", acNormal, "", "", , acNormal
End Sub


On Form 2 (Reservations Detail form)
The OnLoad event would be something like this

Private Sub Reservations_Detail_form_Load()
Me.CustomerID = Forms!Reservation_Form!CustomerID
End Sub


Note that (just in case) these are your real form names I have changed them
by putting _ in all the spaces. - Top tip - don't put spaces in field,
control, module, form, etc, etc names

Hope this helps
 

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