Ask a Question related to Microsoft Access, Design and Development.
-
Mike Geoghegan #1
Filling fields
I have a table named CODES that contains the following
fields:
MainCode field length = 8
Hex1 field length = 2
Hex2 " " "
Hex3 " " "
Hex4 " " "
I would like to enter 8 digits into the "MainCode" field
and have the form automatically take the first 2 digits
and enter them in "Hex1", then the next 2 digits
into "Hex2" and so forth.
Example:
MainCode 12345678
Hex1 12
Hex2 34
Hex3 56
Hex4 78
I can get it to enter the first 2 digits into Hex1 with
this code:
Private Sub MainCode_AfterUpdate()
Dim txtCode As String
Dim Code1 As String
txtCode = Forms!keys!MainCode.Text
Forms!keys!MainCode.SetFocus
Forms!keys!hex1.SetFocus
Code1 = Forms!keys!hex1.Text
Code1 = UCase(Left(MainCode, 2))
If Forms!keys!hex1.Text = "" Then
Forms!keys!hex1 = Code1
End If
End Sub
Can someone help me?
Thanks!
Mike Geoghegan Guest
-
dropdownlist not filling up?
Hi, I have a dropdownlist that contains should contain several values from the database, I fill it up in de page_load() with this code (at the... -
filling pie
Hello all, I want to make a pie chart that would slowly with time (around 50-100 frames) fill with a blue color. What is the best way to do it?... -
filling in forms.
Is it possible to scan in a completed form, save as a pdf file and then edit the entries? -
#26351 [Opn->Bgs]: Incorrect handling of Null Fields/Numerical Fields with '0'
ID: 26351 Updated by: iliaa@php.net Reported By: jabberwocky at ibplanet dot com -Status: Open +Status: ... -
#26351 [NEW]: Incorrect handling of Null Fields/Numerical Fields with '0'
From: jabberwocky at ibplanet dot com Operating system: Any PHP version: 4.3.4 PHP Bug Type: MSSQL related Bug description: ... -
Al Campagna #2
Re: Filling fields
Mike,
Since the MainCode always contains the information needed to fill in
Hex1-Hex4, there's no need to have those fields in your table. They can
always be "re-derived" the values "on the fly" from MainCode in any
subsequent form, query, report, etc.
An example is... if I store Price and Qty, I don't need to store
LineItemCost (Price*Qty), since I can always recalc it whenever it's needed.
In your case, 4 "unbound" calculated fields will display the Hex1-4
values.
The Hex1 ControlSource would be...
= Left(MainCode,2)
The Hex2 ControlSource would be...
= Mid(MainCode,3,2)
The Hex3 ControlSource would be...
= Mid(MainCode,5,2)
And Hex4...
= Right(MainCode,2)
--
HTH
Al Campagna
Candia Computer Consulting
Candia, NH
"Mike Geoghegan" <mgeoghegan@mayinstitute.org> wrote in message
news:28d701c33f4d$d289e530$a601280a@phx.gbl...> I have a table named CODES that contains the following
> fields:
> MainCode field length = 8
> Hex1 field length = 2
> Hex2 " " "
> Hex3 " " "
> Hex4 " " "
>
> I would like to enter 8 digits into the "MainCode" field
> and have the form automatically take the first 2 digits
> and enter them in "Hex1", then the next 2 digits
> into "Hex2" and so forth.
> Example:
> MainCode 12345678
> Hex1 12
> Hex2 34
> Hex3 56
> Hex4 78
>
> I can get it to enter the first 2 digits into Hex1 with
> this code:
>
> Private Sub MainCode_AfterUpdate()
>
> Dim txtCode As String
> Dim Code1 As String
>
> txtCode = Forms!keys!MainCode.Text
> Forms!keys!MainCode.SetFocus
> Forms!keys!hex1.SetFocus
> Code1 = Forms!keys!hex1.Text
> Code1 = UCase(Left(MainCode, 2))
>
> If Forms!keys!hex1.Text = "" Then
> Forms!keys!hex1 = Code1
>
> End If
>
> End Sub
>
> Can someone help me?
> Thanks!
>
>
---
Outgoing mail is certified by AVG 6.0 as Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.493 / Virus Database: 292 - Release Date: 6/25/03
Al Campagna Guest



Reply With Quote

