Closing Form

mohammadagul

PrinceAtif
Local time
Today, 10:37
Joined
Mar 14, 2004
Messages
298
Now my employeer says that?.

If I am at the last of record then the form should close automatically
Lets says that I am navigating through records in a columnar form. When I reach the last record and Press the button to go to Next Record , I should get a Message as follows

?You Have Reached Last Record?

When I Press OK the Form Should Close
Now this is what I am doing

On my form current
If me.RecrodSet = ?? then
Docmd.close
Endif

But it deos not work and gives me an invalid argument error
Any suggestions
 
Code:
If Me.Recordset.EOF Then
...
??
 
please... can you explain something better what you want?
 
In the Name of Allah Most Gracious Most Merciful

Well Now that you have asked that what I want, here is a full fledge story.

1. I have a form tblEmployees which has following fields.

BirthPlaceEnglish
BirthPlaceArabic

NationalityEnglish
NationalityArabic

SexEnglish
SexArabic

ProfessionEnglish
ProfessionArabic

ReligionEnglish
ReligionArabic

MaritialStatusEnglish
MaritalStatusArabic

2. as you can see from the fields above mentioned that for each of the corresponding fields in English I have to have an Arabic Field.
3. Usually when a user is entrying data in Data Entry Mode of ?frmEmployee? there is a code behind the AfterUpdate Event of all the English field which gives the Arabic data in the Arabic Fields.
4. But there are situations when a new company gets the program and installs it on the system they do not want to manually add the employees through the ?frmEmployee? form. So they import data from the Excel into Access. Once in the data is in Access table again they had to go to the frmEmployee Edit Mode and pass through all the records to update the Arabic Fields.
5. So in order to avoid this I have build a columnar form. When the form opens, a timer event Is activated as such.

Time Interval : 150

Docmd.gotorecord,,,acNext

Me.BirthPlaceArabic.value = me.BirthPlaceEnglish.Column(1)

On opening, the focus is moved to each record on the due time interval and get the value from the ?BirthPlaceEnglish? to ?BirthPlaceArabic?

Now the Problem ?.. when the cursor reaches the last record it gives the following Error

Runtime Error 2105
You Can?t Go To Specified Record

I don?t want the user to see this record , instead I want Is that the form should close or should give a confimation message that the record has been updated.

I hope you get the full picture

Note:
In my tabular form, All the English Fields are Combo Boxes, that is how I am getting my value for the Arabic Fields.
 
Hi,

Now it's clear (as i think ;)) to me what you want.

1. Who don't you use an update-query for the conversion (because that's what the form only is used for?

2. Because you got that error, use you errorhandler (in the Timer-eventproc.) to exit the form:
Code:
Private Sub Form_Timer()
  On Error GoTo TimerErr

  ..your actions

TimerExit:
  Exit Sub

TimerErr:
  If Err.Number = 2105 then DoCmd.Close acForm, Me.Name, acSaveNo
  Exit Sub
End Sub
 
Thanks a Lot Guys,,, YUou Are Great.

How stupid of me. had been doing a lot of thing with the error handler . why didnt i think of error handlar...


Thanks a lot for your help

wish i could just give some thing to you for your help
 

Users who are viewing this thread

Back
Top Bottom