Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling numbers apart

Status
Not open for further replies.

Krash878

Programmer
May 8, 2001
172
US
Here is a question
I have an 11 digit code that is entered all at one time. I need to be able to have digit one copy into another feild
and have digit 4,5,and 6 copy into a different feild all in the same table.
I am not sure if there is a code or if there is can someone tell me where to put it
 
Separate them with the "mid" function.

Example:

sCode = txtCode

sFirstNr = mid(sCode , 1, 1)
sFourToSix = mid(sCode , 4, 3)

Or you can use it directly in the query:

INSERT INTO
Table1
(
Field1,
Field2
)
VALUES
(
mid(forms!txtCode, 1, 1)
mid(forms!txtCode, 4, 3)
)
 
Sorry! The address to the textbox in the query should be:
"forms!form1!txtCode"
 
Is this one code and where does it go?
What does the sCode stand for?
Is one for the query and one for the table?
If one is for table where does it go?

I have really I have never done any thing like this. I would prefer for the numbers to copy into the table. Would this go behind the text boxes on the input form in "after update"?
Sorry
Thanks


sCode = txtCode

sFirstNr = mid(sCode , 1, 1)
sFourToSix = mid(sCode , 4, 3)

Or you can use it directly in the query:

INSERT INTO
Table1
(Field1,Field2)
VALUES
(mid(forms!form1!txtCode, 1, 1)mid(forms!form1!txtCode, 4, 3))
 
ok I ma having so much trouble with this

(MerchantID) I have a table that has a feild for Merchant number 11 digits

(CardType) I have a feild for card type uses the first digit of the 11 digit number

(CBID) I have a feild for Member bank that uses the 4,5,6 digits of the 11 digit number.

I would like for this to happen on the Form upon input.
The user types in the merchant ID and (it does not matter if happens in veiw or not) the first number is copied to the CardType Field in the Table(tblChargeBack) and the 4,5,6 is copied to the CBID feild in the same table.

I know this does require the Mid function but where is it placed. Does it go in the form under events or on the Table?
How would the code look using my examples in Quotes above.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top