Need to see if a column exists in a table

geno

Registered User.
Local time
Today, 17:04
Joined
Jun 19, 2000
Messages
243
Hi, I have made a macro that will add two fields to a table then it run's a query to populate these fields. I have this macro on a form command button. I need to test the table to see if someone has already ran the macro, if they have I need a msgbox to come up and let them know that the fields already exist. Thanks for any help...
 
im SURE theres a cleaner way to do this..but have you tried..checking for values in the field..and if you get one.. then display the message box?

example:
create an if then statement..
1) check for values..try using IsNull Function ..if it returns true
2) run your macro
3) if it returns false, display the message box

If isnull([fieldname]) then
docmd.runmacro("macroname")
else
msgbox("CRAP..fields are already there")
end if

try it, post back if im just way off base
 
I have tried what you suggested but when I run the procedure I get an error that Microsoft Access can't find the field referred to in the expression. I have to somehow find out if the field exists, I was thinking maybe trying something with a tabledef expression but I am not familiar with this object. Any more ideas. Thanks
 

Users who are viewing this thread

Back
Top Bottom