DataBase - forcer_un_type_de_champ_à_la_création_de_la_table

Asked By le Nordiste
26-Oct-09 02:17 PM
Bonjour,

J'ai une requ=EAte cr=E9ation de table qui va bien, merci=85
Je la lanc epar un bout de code VB.
je constate qu'un champ num=E9rique
s'affiche =E0 la main en 294300003474 et apr=E9s un lancement par VB
en2,94300003474E+11 .
Comment faire pour forcer le type de donn=E9e


Merci pour votre collaboration,

le Nordiste
StrTableFROM
(1)
StrTableINTO
(1)
VBA
(1)
VB
(1)
CCCc
(1)
FaCourante
(1)
StrCpteFa
(1)
UneTable
(1)
  Dom74 replied...
08-Sep-09 02:22 PM
Bonsoir le Nordiste,

Ton champ, ne serait-til pas un numéro de série d'une machine à exporter
dans un inventaire de parc sous Access ... tenue en amont sur un client
commençant par Per.... ???

Si oui, j'ai le même problème et je n'ai pas trouvé de solution
satisfaisante...sauf à faire un copier-coller du dit champ de la base
distante vers la base locale.

Amités.

Dom74


21abb807-73bb-40e6-adfa-fe414d4a68d2@y9g2000yqn.googlegroups.com...
Bonjour,

J'ai une requête création de table qui va bien, merci…
Je la lanc epar un bout de code VB.
je constate qu'un champ numérique
s'affiche à la main en 294300003474 et aprés un lancement par VB
en2,94300003474E+11 .
Comment faire pour forcer le type de donnée


Merci pour votre collaboration,

le Nordiste
  le Nordiste replied...
26-Oct-09 02:17 PM
Bonjour Dom74,

Tout faux c'est b=E9tement un num=E9ro de facture, mais peu importe, le Pb
pour moi reste entier.
La voie que tu donnes va peut =E9tre m'=E9clairer.


Merci,
  Blaise Cacramp replied...
09-Sep-09 03:10 PM
Selon : Bonjour ou bonsoir

Choisir un type numérique qui peut contenir autant de chiffres, utiliser un
format "000000000000000"
voir s'il peut être subdivisé (année, mois, série)


Cdt, Blaise
----   ----   ----


21abb807-73bb-40e6-adfa-fe414d4a68d2@y9g2000yqn.googlegroups.com...
Bonjour,

J'ai une requête création de table qui va bien, merci…
Je la lanc epar un bout de code VB.
je constate qu'un champ numérique
s'affiche à la main en 294300003474 et aprés un lancement par VB
en2,94300003474E+11 .
Comment faire pour forcer le type de donnée


Merci pour votre collaboration,

le Nordiste
  le Nordiste replied...
26-Oct-09 02:17 PM
r un

C'est une s=E9rie num=E9rique croissante, rien =E0 en extraire.

Comment peut on faire =E7a au sein de la requ=EAte CREATE ?

Plus g=E9n=E9ralement comment donner un type =E0 un champ lors de la requ=
=EAte
CREATE

Merci pour votre aide

le Nordiste
  3stone replied...
10-Sep-09 07:06 AM
Salut,


Le SQL ne propose pas les possibilit?s du VBA...
http://www.3stone.be/access/articles.php?lng=fr&pg=26

--
A+
Pierre (3stone) Access MVP
Perso: http://www.3stone.be/
MPFA: http://www.mpfa.info/  (infos g?n?rales)
  le Nordiste replied...
26-Oct-09 02:17 PM
qu=EAte

D=E9sol=E9 c'est pas une CREATE mais directement ceci :
lanc=E9 dans VB car il ty a des parametres :

'**********************************
'supprimer la table FaCourante pr=E9c=E9dente
On Error Resume Next                  'Si il n'y a pas d'ancienne
table temporaire
CurrentDb.TableDefs.Delete (strTableINTO)         'Suppression de
l'ancienne table
On Error GoTo Erreur                   'Reprendre le traitement normal
des erreurs


'INITIALISATION DE LA REQU=CATE
strSQL =3D "SELECT " _
& "UneTable.Champ4 AS PRESTATION, " _
& "UneTable.Champ6 AS DEBUT, " _
& "UneTable.Champ7 AS FIN, " _
& "UneTable.Champ10 AS MONTANT, " _
& "INTO [" & strTableINTO & "]" _
& "FROM [" & strTableFROM & "] AS UneTable " _
& "WHERE (((UneTable.Champ4)=3D""crit1"")" _
& "And ((UneTable.Champ4) Like ""*MES*""));"
**********************************

Je supprime la table en premier pour n'avoir que les dernieres
valeurs.

peut =EAtre suivant ton exemple faut il faire un CREATE entre la
suppr'ssion et la reprise des nouvelles donn=E9es.
=C0 moins qu'on ne puisse faire tout en un coup :

eg : & "UneTable.Champ10 AS MONTANT CURRENCY, " _

Merci pour tes conseils avis=E9s,
J'ai fait un saut sur ton site : pas mal comme mine de renseignements.

le Nordiste
  3stone replied...
10-Sep-09 08:12 AM
Salut,

[...]


C'est une mauvaise id?e de supprimer une table pour la recr?er.
Il faut vider une table, ainsi elle garde toutes ses propri?t?s.

Les bases de donn?es qui cr?ent des tables ? tour de bras
n'ont g?n?ralement pas b?n?fici? d'une pr?paration suffisante.

Les cas de cr?ation de table doivent rester exeptionnels.

--
A+
Pierre (3stone) Access MVP
Perso: http://www.3stone.be/
MPFA: http://www.mpfa.info/  (infos g?n?rales)
  le Nordiste replied...
26-Oct-09 02:17 PM
De toutes fa=E7on =E7a marche pas parce que ma 2=E9me requete trouve devant
elle une table du m=EAme nom donc erreur.

Je suis ton conseil de cr=E9er la table avant toute chose,
puis je la vide ( comment faire d'ailleurs?)

et je refais ma requ=E8te pour remplir ma table
  le Nordiste replied...
26-Oct-09 02:17 PM
voila qui est fait :

Un premier code  pour initialiser la table  : SQL =3D CREATE =85 lanc=E9 un=
e
seule fois dans la vie de la base.
Un second code qui  purge la table puis  ins=E9re les donn=E9es du mois =3D
SQl : INSERT INTO=85
autant de fois qu'il y a de documents sources.

PAR CONTRE un dernier probl=E9me :
J'extrait du nom du document source le NumCpte qui se pr=E9sente sous la
forme  C-CCCCC
C =E9tant des chiffres , extrait par un MID$ ou un MID, c'est le m=EAme
r=E9sultat sous VB.

Dans ma table je ne trouve que _CCCc    le premier chiffre est perdu
et celui =E0 droite est modifi=E9.
Pourqoui et comment corriger =E7a ?

Merci
  le Nordiste replied...
26-Oct-09 02:17 PM
Pb r=E9solu : lorsqiue j'extrait strCpteFa du nom de la table, je
rajoute des guillemets de part et d'autre

strCpteFa =3D """" & Mid$(strTableFROM, 27, 7) & """"


Je passe =E0 l'efficace en abandonnat la puret=E9 et la beaut=E9. MAIS =C7A
MARCHE


Une autre solution =E0 proposer ?


Merci du sacr=E9 coup de main 3stone.
Create New Account
help
Outlook (1) I should note that I am using the data macro to call a VBA function (by setting a local macro variable to the result of the function call). So this is not for the web, I did not see a problem with calling a VBA function (and various places I have seen online mentioned workarounds for calling VBA from a data macro). But, again, while it works when I insert a record in note? In it I added that I was using the AfterInsert macro to run some VBA code (by setting a local variable to the result of a function call). Maybe that maybe that is the problem Yes, in this case, you need a copy of the VBA in the front end. (for testing you can place it in both - since if you happen to open the back end table directly, then the VBA code is ALSO required since the front end might not even be open and the talk to that may be sitting on your computer. So when the trigger fires, that VBA code will be required. So, the VBA needs to exist in the front end if that all you opened. However, if you
reusable for more than one client. So we now develop to a office standard (and VBA). Our next and software for the cloud will be built to the sharepoint standard (at shape to be compatible for upload? But not with native Access forms. Not with standard VBA. This means it may be *similar* to Access (and thus very easy for us to web, and one for local. In fact you can even execute an open form from VBA and openform works fine if you feed it a web form name. as mentioned, you can have a mix of VBA forms, and web only forms in the same application. When you publish the application, those help you trace the interconnections between all the macros, the same way you can with VBA. This is my biggest concern about all of this, that by going to macros, you client and the web. However for some things like payroll processing etc then you need VBA. Obviously only the controller / accountant person in your organization will need the advance VBA part of the application. For employees to enter their time sheets and hours, check their not for a very, very long time (despite the false dawn of Office 97 with VBA as platform for developing complex meta-apps for small businesses). I do not quite understand
VBA vs Macros DataBase Let me preface this by saying it is a sincere question. I Using Access 2010 I note that help tells us to use macros in preference to VBA for web apps and for greater security. Also a VBA to macro converter is provided but not the other way around. Why so down on VBA? Once upon a time it was considered that for any serious development VBA was preferred to macros because it had a) error trapping (where untrapped errors would crash runtime installation of Access) and b) greater power and flexibility. Are these two advantages of VBA over macros still true with 2010? Other than for web apps (which I am not doing) should I change to macros or stick with VBA? When I took up Access I learned VBA and only did macros when it was the only way for certain operations. Other than
SQL help DataBase I am trying to access a table in a mdb using VBA though a brain dead program. The problem is it is modifying the the text inside line in it is editor. strSql = "SELECT tblParts.[PART#] FROM tblParts WHERE (((tblParts.[PART#]) = '" & FileName & "'));" VBA sees the following strSql = "SELECT tblParts. FROM tblParts WHERE (((tblParts.) = '" & FileName & "'));" Is there isomeway I SQL group? Access Discussions SQL Server (1) Office (1) Module (1) Macro (1) Date (1) VBA (1) VB (1) Environment (1) Huh? I think you are actually saying that you are trying to write VBA code in a brain dead text editor. You need to identify the editor. Why not use the VBA IDE in Access? Ughhh! Get rid of those unnecessary parentheses! And the semicolon as well are using, it is impossible to advise you how to escape them. it is not VBA doing this so I suspect the VBA escape method (doubling the characters that you want to be treated literally) would work. It
big of post do you want? Perhaps the big news is the new version of VBA, or what we call VBA 7. This new version of VBA now has a true pointer data type called longPtr. We also get a 64 bit the term JET, but I really talking about ACE). Note that this new version of VBA of course is also runs on the 32 bit version of windows. -> Database triggers and features are are more oriented towards developers (such as a new data Pointer type in VBA - we never had a data pointer type in VBA. Too bad we did not, as the switch to 64 bits would have been seamless all well, when we jump to 128 bit computers, Access and VBA will be ready because we now have a true pointer data type). Other features will on the surface it looks like a giant leap forward for Access, and also for VBA. I was not aware of the table triggers - very cool. I like using triggers and