Link to home
Start Free TrialLog in
Avatar of Fourte
Fourte

asked on

Using smart tags between Access 2003 and Office Calendar

I have a field (anticipated start date) within a database.
So far using a smart tag the calendar opens up as at the current date.
Is there any way to:
     1.   Open the calendar up at the date that is within the field.
     2.   Make an entry into the callendar (the content of another field on the form)
This is the first time that I have used smart tags which are a totally new concept to me.
Is there any kind guy out there who can put me straight?
Kind regards
Peter
Avatar of nico5038
nico5038
Flag of Netherlands image

Avatar of Jeffrey Coachman
Just a question...

Why do you need the smart tags to accomplish this?

(for simplicity, the following example assumes that the calendar is on the same form as the field you need)

You can set the value of the calendar to be equal to the date that is within the field by using something like this on the forms OnCurrent Event:
YourCalendarControlName=YourFieldName

Then you can update the value in the field if you select a date in the calendar by using something like this on the calendars AfterUpdate event:
YourFieldName=YourCalendarControlName

No smart tags needed at all.

Or am I missing something here?
Avatar of Fourte
Fourte

ASKER

Now that is more like it!!
I don't follow you completely.   I have had a series of strokes that caused brain damage so following things like this is somewhat difficult for me.
I have a form, 'allocate job number', on which there are details relating to the job.   Basically these are:
Job Number, Customer detail, anticipated date for work to be carried out.
I had used a smart tag on the anticipated date to open the calendar.

Are you saying that I can make a window within the form contain a page of the calendar?   If you are it would be realy sweet.

What I want is to force the user to enter the job number and job details into the calendar before he can exit the form.

Any further help that you can give me would be very much appreciated.

Kind regards

Peter
For forcing fields to be entered I simply use a [Save] button wit code like:

Private Sub btnSave_Click()
Dim txtMessage As String
On Error GoTo Err_btnSave_Click
    ' init error message
    txtMessage = ""
    ' Check fields in reverse order to set focus to the first
    If Not Len(NZ(Me.Description)) > 0 Then
        txtMessage = "Description empty ?" & vbCrLf
        Me.Description.SetFocus
    End If
    If Not Len(NZ(Me.Severity)) > 0 Then
        txtMessage = "No Severity?" & vbCrLf & txtMessage
        Me.Severity.SetFocus
    End If
    If Not Len(NZ(Me.Type)) = 0 Then
        txtMessage = "Recordtype empty ?" & vbCrLf & txtMessage
        Me.Type.SetFocus
    End If
    ' Check error found
    If Len(txtMessage) > 0 Then
        MsgBox txtMessage
        Exit Sub
    End If
   
    DoCmd.Close

Exit_btnSave_Click:
    Exit Sub

Err_btnSave_Click:
    MsgBox Err.Description
    Resume Exit_btnSave_Click
   
End Sub

and combined with a [Cancel] button to allow the user to stop whenever (s)he wishes to.
For getting the datefield filled initially you can use in the form's OnOpen (or OnCurrent) event:
If Len(nz(Me.Datefield)) = 0 then
   me.datefield = Date()
endif

Nic;o)
Avatar of Fourte

ASKER

Thanks a lot - I shall have to get my mind around this!
Back to the calendar - can this be part of the form?
Thanks
Peter
I always use the minicalendar of http://www.mvps.org/access/forms/frm0050.htm (keep shift pressed when opening)
This small form can be changed as you like as it's "all Access".

Nic;o)
Avatar of Fourte

ASKER

This sounds perfect!   I downloaded the package and extracted.
 then went to open (holding down the shift) and access said that it was produced in an earlier version.
I tried to open and also to convert (to 2003).
Access chewed it up and spat it out then closed down!
Help !!!
Peter
ASKER CERTIFIED SOLUTION
Avatar of nico5038
nico5038
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks nico5038
Avatar of Fourte

ASKER

Thanks Nico,
It is now up and running.
I don't know how to allocate more points as this next question deserves them.   Perhaps you can tell me?

Question: having now got the calendar up, is it possible to open the calendar in order to input some text?
i.e.   F51ASD (registration number) MOT (type of work being undertaken) 4.5 (anticipated time required)

These fields do exist on the form, but can simply be entered freehand.

Kind regards,
Peter
When you use the Calendar "standalone", then remove the code to fill the "activecontrol" when the form is closed and bind the form to the table with the fields you mentioned.
Personally I prefer to have a simple form with the fields and a button to activate the calendar. (See sample .mdb form)
Thus a user can use the datefield as (s)he pleases. (Personally I use the CTRL+; often to enter the systemdate and that's faster as clicking a popup calendar :-)

See this as free advise, I'm not here for points but for helping and "officially" a question should only contain one question. Thus I regard this as "the same" :-)

Nic;o)
Avatar of Fourte

ASKER

Nico,
THanks a lot for your help - it is very much appreciated and not just assumed.
I have done as you suggest in the second line.
The first line is a little above my brain acpability at the moment and I will come back to it when I have rested, but am I right to say that:
If I were to concactinate two or three of the fields on my form then use the resulting field to tie to the calendar, would this work or am I way off base?
I am sorry to be a pain but it is like trying to learn how to read again at the moment.
Thank you
Peter
>If I were to concactinate two or three of the fields on my form then use the resulting field to tie to the calendar, would this work or am I way off base?
No, that won't work without additional coding.
This would imply that you have to "move" the fields from the calendarform into another form (or table?) when the calendar closes. Personally I see little additional value to do this as finally the result will be visible on another form.
Perhaps I'm missing why you want to combine these three fields and a date in a popup calendarform.
Can you describe why you want to combine this perhaps a bit more from the user's point of view ?

Nic;o)
Avatar of Fourte

ASKER

Hi,
What I am trying to achieve is the following.
The form that I am working on is a Job sheet.   On it I have the job number, a vehicle registration number, a brief description of the work to be carried out and the anticipated date on which it will be done.
This detail forms the key to carry out further functions such as ordering parts etc.   No job number no parts etc.

What I am trying to achieve is to enter this data directly into a calendar/schedule.   Jobs can be raised some weeks before they are carried out and could be forgotten when creating the workflow.   By forcing an entry into the calendar/schedule at the time the job sheet is raised will, in effect, create the workflow automatically.

The only reason for the calendar to appear at the time is so that the user would be able to see what work had already be scheduled for that day, and so allow another day to be chosen if necessary.

Sorry for the rambling, but I hope this will explain.

Peter
Hmm, did a similar thing with this calendar to show howmuch reservations were made on a certain date.
I placed all date fields (D001 till D042) in a row and added underneath a row with fields named A001 till A042.
Then I created a query to count the number of reservations per day and set the backcolor to yellow or red.
The cmbJaar and cmbMaand were added to let the user choose the Year and Month

Just check this code from the OnOpen event:

Private Sub Form_Open(Cancel As Integer)
Dim intI As Integer
Dim dtStart As Date
Dim dtEnd As Date
Dim rs As DAO.Recordset

If IsNull(Parent.cmbJaar) Then GoTo exit_form_open

Me.WD = Parent.WD
dtStart = DateSerial(Parent.cmbJaar, Parent.cmbMaand, "01")
dtEnd = DateSerial(Parent.cmbJaar, Parent.cmbMaand + 1, "00")

intI = Parent.WD - Parent.DateStart
Me.txtMaand.Left = Me.Controls("d0" & Right("00" & Abs(intI), 2)).Left
Me.txtMaand.Width = Me.D001.Width * (dtEnd - dtStart + 2)
'select data
Set rs = CurrentDb.OpenRecordset("select count(*) as ReservationCount, Datum from tblReservation group by artist, datum having Datum between #" & Format(Me.D001, "yyyy/mm/dd") & "# and #" & Format(Me.D042, "yyyy/mm/dd") & "# ;")
If rs.EOF And rs.BOF Then
   ' no records
Else
   rs.MoveFirst
   While Not rs.EOF
      If rs!ReservationCount > 1 Then
         Me.Controls("d" & Format(rs!Datum - Me.D001 + 1, "000")).BackColor = vbRed
      Else
         Me.Controls("d" & Format(rs!Datum - Me.D001 + 1, "000")).BackColor = vbYellow
      End If
      rs.MoveNext
   Wend
End If


Me.Refresh
exit_form_open:
End Sub

Just a sample to give an idea to represent your data.

Nic;o)
Avatar of Fourte

ASKER

I can follow what you have done.   A good piece of coding.   Before my strokes this would have been right up my street, but now find it really hard work.
Unfortunately this would be overkill for what I am trying to achieve.
The minicalendar is the key I think. It allows the user to decide, for example, that the job can be done in two weeks time on a Thursday.   This he can do without referring to a calendar on the wall.   If I can then include a SmartTag that will open the Outlook calendar on that specific date (s)he can type in the details manually.   It will also allow the user to see what jobs are committed for that day and to move to a differend date should it be necessary.

I would very much like to thank you for everything that you have done - above and beyond the call of duty!!

When I was well I was fluent in seven different languages and had fourty two years of computer experience behind me.    Most of the learning was done at dedicated colleges run by the particular computer manufacturer.   When you passed a particular course you were of course told but did not get the relevant certificates   These were kept by the company that you worked for, the excuse being that they had paid for you to attend.   The certificates were then diplayed to show how well the company had done!   How things have changed.

The point that I am trying to make is that had such a facility as Experts Exchange existed in those days, standards within the computer sciences would probably have been much higher.   The fact that you and other specialists are prepared to give of your time for no material return to teach those of very limited knowledge is something that should be broadcast far and wide beyond the portals of this site.

Finally, now that I have finished rambling, would you be offended if I were to put the subject, as I described in my last message, back onto the site under the headings of Access and possibly Office of specifically Outlook?   It may shine a little further light on what I believe to be a very interesting subject.

Once again, many thanks,

Peter
Thank you for your kind words Peter !
Ofcourse I'm not offended when you post an Outlook question.
Personally I always advise for time keeping to use Outlook instead of rebuilding that in Access.
Access does however cooperate also very well with Outlook and you might check into the automation of Outlook from Access.

Success with your project !

Nic;o)