Populate Textbox from Value in Combo.

Lensmeister

Registered User.
Local time
Today, 20:02
Joined
Feb 18, 2009
Messages
65
Hi,

I have searched through here and I think I am missing something.

I am using Access 2003 and I have a table called tbl_22

Code:
Fields are:
ID | Location | Miles | etc.
i.e.
1 | London | 0.00 | etc.
2 | East Croydon | 10.50 | etc.
3 | Gatwick | 26.68 | etc.

Or my form frm_M_Calc I have the following

Code:
combobox called cbo_Origin.
combobox Called cbo_Dest.
Textbox called txt_OMile
Textbox called txt_DMile
Textbox called txt_Diff.

cbo_Origin is linked to the table to the Location as id the cbo_Dest.

I would like to be able to choose i.e. East Croydon and Gatwich in Origin and destination respectivly and have the miles appear in the textboxes. How can I do this?

Then in the textbox diff it to the calculation 26.68 - 10.50 and give the answer.

Any help would be apprciated :)

Many thanks.
 
Posible Solution

On the AfterUpdate of both of the combo boxes you can call a Sub

Code:
Call CalcDiff()

Code:
Sub CalcDiff()
If Me.Cbo_Origin <> "" And Me.Cbo_Dest <> ""  Then
   Me.Txt_OMile = Me.Cbo_Origin.Column(1)
   Me.Txt_DMile = Me.Cbo_Dest.Column(1)
   Me.TxtDiff = Val(Me.Txt_DMile) - Val(Me.Txt_OMile)
End If
End Sub

David
 
I keep getting this error

Macrosoft Office Access can't find the macro 'Call CalcDiff().'

The Macro (or it's macro group) doesn't exist, or the macro is new but hasn't been saved .......

What's that mean ?
 

Users who are viewing this thread

Back
Top Bottom