Column Question

Vassago

Former Staff Turned AWF Retiree
Local time
Today, 17:57
Joined
Dec 26, 2002
Messages
4,696
Is there any code I can place behind a button in a form that will actually add a column to an existing table?

Thanks in advance

Vassago
 
Look up the CreateField (DAO) command in the help, Stupid.
 
Here ya go...

Code:
Private Sub MyButton_Click()
  DoCmd.RunSQL("ALTER TABLE myTable ADD COLUMN myNewColumn TEXT(30)")
End Sub

For more information, visit this link

Cheers!
 
Damn me and my longwinded coding practices!

Good to know so cheers, jdjewell.
 
A little harsh, don't you think?

Look up the CreateField (DAO) command in the help, Stupid.

Everyone has to start somewhere, I hope you don't tell kids they're stupid when they ask you questions.
 
Re: A little harsh, don't you think?

jdjewell said:
Everyone has to start somewhere, I hope you don't tell kids they're stupid when they ask you questions.

It's alright, Vassagogeuse and I have an understanding. :D
 
Oh...

I'm sorry, I didn't know it was one of those "Love/Hate" relationships
 
Just a friendly sarcasm feud...etc. :p
 
Actually it's a love/hate relationship with himself as Vassago and Mile are ONE AND THE SAME PERSON! (and no, they are not siamese twins no matter how much they try to convince you that they are). Now it has really gotten bad. The personalities are starting to feud among themselves. Maybe one will kill the other and we'll all be out of our Vassago / Mile misery. Hopefully no Hollywood types will ever discover him/them and make anothe Sybil movie. What a bore that would be, watching him/them surf the internet all day looking for obscure avatars, coding late into the night on Access databases to inventory each personalities possessions. "That's my hat, damn it!" it says so in the database.

Autoeng
 
"Thanks for the reply me, but don't call me stupid"

"All call you stupid if I want!"

"Oh Yeah! Take that!"

"Ouch, you stupid arse!"

"Hey, I said don't call me STUPID!"

Okay, just one more questions, what about deleting a column? Just as simple?

Thanks a lot for all of my, errr I mean your help! :D
And thank you for your link jdjewell, that is a LOT of help.

Vassago

Autoeng - Are we really causing you misery? :)
 
Last edited:
Only when you change your avatar. If I guese you three more times will you go back where you came from. HEY!!! Come to think of it you didn't really split your personality until someone guesed you (off to another window to see who let you loose)....

AAAAUUUUUGGGGGHHHHHH It was your other personality, Mile, who let you loose!!!!! How creepy is that? From that we can only assume that you are only a figment of Mile's imagination.

Mile,

It's time to send your alter ego packing, or at least put him on a shorter leash.

Autoeng
 
HEY!!!! HE'S THE ALTER EGO!!! Not me! I'm the normal one.
 
Autoeng said:
watching him surf the internet all day looking for obscure avatars

I don't think my avatar is obscure although some might - it's a photograph of Blixa Bargeld, the frontman of German art-industrial band, Einsturzende Neubauten who's also a guitarist with Nick Cave & The Bad Seeds.

What was the Cybil movie?

Vassago, on your second question you could try messing about with jdjewell's code with something like this:

Code:
Private Sub MyButton_Click()
  DoCmd.RunSQL("ALTER TABLE myTable DELETE COLUMN myNewColumn")
End Sub
 
Yeah, thanks, I already got something working. Now I'm off to bigger and better things! Thanks though...

I think it's time for an avatar change....hmmmm
 
Sybil was the most publized multi-personality disorder sufferer. She had like 20+ personalities, both male and female, adult and child. Lived in Kentucky. Died awhile back.

Autoeng
 
Just an FYI to this older post. There was a suggestion on how to delete a column using:

Private Sub MyButton_Click()
DoCmd.RunSQL("ALTER TABLE myTable DELETE COLUMN myNewColumn")
End Sub

I couldn't get this to work due to a syntax error. After searching a little I found that this worked for me:

Private Sub MyButton_Click()
DoCmd.RunSQL("ALTER TABLE myTable DROP COLUMN myNewColumn")
End Sub
 

Users who are viewing this thread

Back
Top Bottom