Simple question - please help me arghhh!!!!!!!! 
Author Message
 Simple question - please help me arghhh!!!!!!!!

Dear Developers,

I am trying to implement the following algorithm in the following forms.
Can you help me please?

Kind Regards,

Moby.

Algorithm for Calculator form:

Enter:  1.  Chart ID  -----error detection for valid ChartID  ie already
in  database.

Enter:  2.   True Bearing  0 - 359 degrees  as  DEGREES -------error
detection for values in the range 0 - 359.

Enter:  3.  Current Year:  eg 1999  as a number -------error detection
for years not exceeding 4 digits.

 I am having difficulty with getting this calculator form to work which
should calculate the Compass course (ie bearing) by accessing the
Variation information in the NAV_Navigation.mdb file.  

The calculator form consists of the following fields:

Chart ID,

True Bearing,

Current Year.

The button Compass bearing will calculate the Compass course.

This calculator is the backbone of this application.  Since the Chart
data has been successfully stored in the database (which I have modified
by deleting date field and having Base Year as a number), the calculator
will access that.

The user will be able to calculate the Compass course (bearing) based on
a single Chart ID for any year.  Now in the form the Chart ID is entered
(between 0 - 359 ? error handling is present to make sure the numbers in
this range are entered).

The Variation for that Chart Id for that Base Year is extracted from the
table NAV_Navigation.  See NAV_Navigation.mdb.

The Current Year is entered.

The Chng_Variation is calculated for the Curr_Year as follows:

Chng_Variation = Variation  + /_    (Annual_Variation) * (Curr_Year -
Base_Year))  

The +/- since same directions add different directions subtract.

The Chng_Variation is then rounded to the nearest degree (30 ' and
greater round up).   (Note 60 ' (minutes) in a degree).

This figure  minus the Variation for the current Year  ie
Curr_Variation  as follows:

If  Curr_Variation = West  - ie is +tve

then Compass_bearing = True_bearing  + Curr_Variation

If Curr_Variation = East    ------  ie is East  is - tve

Then Compass_bearing = True_bearing   -  Curr_Variation

This is the coding:

Main form:

Private Sub mnuAddRecord_Click()
    frmAddInfo.Show vbModal
End Sub

Private Sub mnuEditRecord_Click()
frmEditInfo.Show vbModal
End Sub

Private Sub mnuExit_Click()
    Unload Me
    Unload frmAddInfo
    End
End Sub

Private Sub mnuLoadCalculator_Click()
Dim ListPosition As Integer
    ListPosition = InStr(List1.List(List1.ListIndex), "Chart_ID")
    If ListPosition > 0 Then
        frmCalculator2.SelChart_ID =
Format$(Val(Mid$(List1.List(List1.ListIndex), ListPosition + 9)))
        frmCalculator2.Show vbModal
    Else
        MsgBox "Select Chart ID that you want to calculate"
    End If
End Sub

Private Sub mnuRefreshList_Click()

    LoadDatabaseDataToList
    List1.AddItem ("Finished searching at" & Now)
End Sub

Calculator form:

Option Explicit

Public SelChart_ID As String

Private Sub cmdCalculate_Click()
    'I need code here to calculate course based on data extracted
    'in the form load code.
End Sub

Private Sub Form_Load()
Dim Variation As String
Dim AnnualVariation As String
Dim BaseYear As Long
    NavRecords.MoveFirst
    NavRecords.FindNext ("Chart_ID = " & SelChart_ID)
    If Not (NavRecords.EOF) Then
        txtChart_Id.Text = SelChart_ID
        Current_Year.Text = Format$(Now, "YYYY")
        Variation = NavRecords!Variation
        AnnualVariation = NavRecords!Annual_Variation
        BaseYear = NavRecords!Base_Year
        'now calculate Chng_Variation based on Variation,
AnnualVariation, and Now-Val(Current_Year.Text)
        'Can anyone do this using the algorithims I stated before,
    Else
        MsgBox "Record not found. Cannot continue.", vbCritical
    End If
End Sub



Thu, 05 Sep 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. SIMPLE SIMPLE ListView Question. Please help

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. SIMPLE QUESTION, please SIMPLE ANSWER

4. Simple question, please help!

5. Simple question, Please Help!!! :)))

6. Please Help with a simple question

7. Simple Question! Please Help

8. Simple question...please help

9. Simple question..help please

10. Please Help with a simple question

11. Please Help With Simple Question

12. PLEASE HELP: simple question

 

 
Powered by phpBB® Forum Software