please help a newbie solving a problem

R

Rani

guys, this is the third time I post the same question, and I do apologize
for it.
I crated a form based on a query.
in the form - a continues form - I display the information pretends to a
salesman according to his activities per month.
the form as an unbound combobox based on the salesperson name from the
query. I declared an afterupdate event in which I run the requery
(me.requery)
I have few issues with this form:
1. if I don't select a default salesperson name - the form will load empty,
and will not let me do anything.
2. if I define a default name, the form will let me choose different
salesperson, but the appropriate data will not change meaning if I selected
a sales person with 8 different type of activities, it will display all 8 of
them but then when I select a sales person with 4 type of activities the
system will replace the data with the appropriate lines but will live the
remaining activities on the screen

what do I do ?
 
N

NetworkTrade

1. if I don't select a default salesperson name - the form will load empty,
and will not let me do anything.

*** this seems logically correct i.e. no name - no data..... you could put
in some code that pops-up a warning that no salesname has been selected; but
I can't determine whether you can change this behavior based on only this
info..... if you don't have experience with message boxes you might simply
add a label in RED CAPS to remind the person to highlight a name before
selecting.....

2. if I define a default name, the form will let me choose different
salesperson, but the appropriate data will not change meaning if I selected
a sales person with 8 different type of activities, it will display all 8 of
them but then when I select a sales person with 4 type of activities the
system will replace the data with the appropriate lines but will live the
remaining activities on the screen

**** I would try just refreshing the screen by using a macro on whatever
button/event creates the change in data to first close the form, then re-open
the form based on the new entry....it won't be perceivable
 
R

Rani

1. I will find a way to do that.
2. how do I refresh the screen, assuming the screen name is avit, I can
close it by doing:
docmd.close
and then reopon it by using docmd.open("avit")
but how do i requery it ?
so far i am using me.requery but as the focus changes i need to use
something else and i don't know what.
thanks for the help
 
N

NetworkTrade

2. how do I refresh the screen


*** Macro

purists that are hardcore VB writers don't bother with Macros....but when it
comes to closing a form, opening a query, and then reopening a form.....using
a macro is pretty easy.

not sure if your screen is form or query or report or what - - but in any
case explore/lookup the basics of a simple macro and I think you will find
that you can easily string together some events that will close it and
reopen....
 
N

NetworkTrade

although macros are not difficult; I don't find such education really not
feasible via this type forum......too much typing..

there is a point where Access is not intuitive - so I would recommend
something like Access for Dummies (no offense meant !!) or possibly online
tutorials you may be able to find online......
 
A

access user

Hi Rani

Private Sub cmdUpdate_Click()
On Error GoTo ErrorHandler

DoCmd.Close acForm, "avit"

Dim stLinkCriteria As String

DoCmd.OpenForm "avit", , , stLinkCriteria

Me.Form.Requery

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

Hope that helps (it's the "Me.Form.Requery" bit which refreshes the form,
and the code given above should be put on the click event of a button)
Raja
 
R

Rani

i tried implementing the code
but i am getting error 2467 the expression you entered refers to an object
that is closed or doesn't exist,
any idea ?
 
Top