Form updating

  • Thread starter Thread starter lisa
  • Start date Start date
L

lisa

Hi

I have created a customer sales database.
I have the following forms open: Customer information and
Order form.

A new customer calls and is added via the Customer
information form. I then move over to the Order form - in
the order form the customer name is selected from a combo
box (which is from the record in the Customer information
form)

My problem is when a new customer is added I can't see
them in the combo box list unless I close the customer
form and then open the order form.... what can I do so
the customer & order forms can always be open and the
data updates ??? Thanks
 
Use the AfterUpdate event procedure of the Customer form to requery the
customer combo on the Orders form

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Orders").IsLoaded Then
Forms("Orders")!CustomerID.Requery
End If
End Sub

Notes:
1 Replace "Orders" with the name of your form, and "CustomerID" with the
name of your combo.

2. If you are using a version of Access older than 2000, copy the IsLoaded()
function from the Northwind sample database, and replace the first line
with:
If IsLoaded("Orders") Then

3. You may want to do the same in the AfterDelConfirm event of the Customer
form.
 
HI

I've tried the solution provided (thanks for that!) but
couldn't get it to work.

My coding is below, please let me know where I'm going
wrong

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms([Order form]).IsLoaded Then
Forms ([Order Form]!Combo62.Requery
End If
End Sub

Thanks
 
Hi Lisa

Just confirming that you have set the AfterUpdate property of the Customers
form to:
[Event Procedure]
and added the code there (not to the Order Form).

Try Spaces instead of square brackets:
Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Order form").IsLoaded Then
Forms ("Order Form")!Combo62.Requery
End If
End Sub

Then choose Compile from the Debug menu to make sure VBA understands the
code.

If it still does not work, post back and we will explain how to set a break
point and step through your code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

lisa said:
I've tried the solution provided (thanks for that!) but
couldn't get it to work.

My coding is below, please let me know where I'm going
wrong

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms([Order form]).IsLoaded Then
Forms ([Order Form]!Combo62.Requery
End If
End Sub

Thanks
-----Original Message-----
Use the AfterUpdate event procedure of the Customer form to requery the
customer combo on the Orders form

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Orders").IsLoaded Then
Forms("Orders")!CustomerID.Requery
End If
End Sub

Notes:
1 Replace "Orders" with the name of your form, and "CustomerID" with the
name of your combo.

2. If you are using a version of Access older than 2000, copy the IsLoaded()
function from the Northwind sample database, and replace the first line
with:
If IsLoaded("Orders") Then

3. You may want to do the same in the AfterDelConfirm event of the Customer
form.
 
Hi Allen

I appreciate your help.

I have put the code in the correct place and made the
changes per your comments but when I select Compile I get
the message:

Compile error:
End if without block if>?????????
-----Original Message-----
Hi Lisa

Just confirming that you have set the AfterUpdate property of the Customers
form to:
[Event Procedure]
and added the code there (not to the Order Form).

Try Spaces instead of square brackets:
Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Order form").IsLoaded Then
Forms ("Order Form")!Combo62.Requery
End If
End Sub

Then choose Compile from the Debug menu to make sure VBA understands the
code.

If it still does not work, post back and we will explain how to set a break
point and step through your code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I've tried the solution provided (thanks for that!) but
couldn't get it to work.

My coding is below, please let me know where I'm going
wrong

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms([Order form]).IsLoaded Then
Forms ([Order Form]!Combo62.Requery
End If
End Sub

Thanks
-----Original Message-----
Use the AfterUpdate event procedure of the Customer
form
to requery the
customer combo on the Orders form

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Orders").IsLoaded Then
Forms("Orders")!CustomerID.Requery
End If
End Sub

Notes:
1 Replace "Orders" with the name of your form, and "CustomerID" with the
name of your combo.

2. If you are using a version of Access older than
2000,
copy the IsLoaded()
function from the Northwind sample database, and
replace
the first line
with:
If IsLoaded("Orders") Then

3. You may want to do the same in the AfterDelConfirm event of the Customer
form.


Hi

I have created a customer sales database.
I have the following forms open: Customer information and
Order form.

A new customer calls and is added via the Customer
information form. I then move over to the Order
form -
in
the order form the customer name is selected from a combo
box (which is from the record in the Customer information
form)

My problem is when a new customer is added I can't see
them in the combo box list unless I close the customer
form and then open the order form.... what can I do so
the customer & order forms can always be open and the
data updates ??? Thanks


.
 
Did you miss the line starting with
If

Or did you enter the End If line twice?

BTW, this is all one line (even though it looks like it was broken in the
posting):
If CurrentProject.AllForms("Order form").IsLoaded Then

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

lisa said:
Hi Allen

I appreciate your help.

I have put the code in the correct place and made the
changes per your comments but when I select Compile I get
the message:

Compile error:
End if without block if>?????????
-----Original Message-----
Hi Lisa

Just confirming that you have set the AfterUpdate property of the Customers
form to:
[Event Procedure]
and added the code there (not to the Order Form).

Try Spaces instead of square brackets:
Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Order form").IsLoaded Then
Forms ("Order Form")!Combo62.Requery
End If
End Sub

Then choose Compile from the Debug menu to make sure VBA understands the
code.

If it still does not work, post back and we will explain how to set a break
point and step through your code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I've tried the solution provided (thanks for that!) but
couldn't get it to work.

My coding is below, please let me know where I'm going
wrong

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms([Order form]).IsLoaded Then
Forms ([Order Form]!Combo62.Requery
End If
End Sub

Thanks
-----Original Message-----
Use the AfterUpdate event procedure of the Customer form
to requery the
customer combo on the Orders form

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Orders").IsLoaded Then
Forms("Orders")!CustomerID.Requery
End If
End Sub

Notes:
1 Replace "Orders" with the name of your form,
and "CustomerID" with the
name of your combo.

2. If you are using a version of Access older than 2000,
copy the IsLoaded()
function from the Northwind sample database, and replace
the first line
with:
If IsLoaded("Orders") Then

3. You may want to do the same in the AfterDelConfirm
event of the Customer
form.


message
Hi

I have created a customer sales database.
I have the following forms open: Customer information
and
Order form.

A new customer calls and is added via the Customer
information form. I then move over to the Order form -
in
the order form the customer name is selected from a
combo
box (which is from the record in the Customer
information
form)

My problem is when a new customer is added I can't see
them in the combo box list unless I close the customer
form and then open the order form.... what can I do so
the customer & order forms can always be open and the
data updates ??? Thanks
 
Back
Top