access vba - table columns not in form

There is a table and a form on the top of that table. Now overtime, users add in more columns to the table. The form still shows the old columns but not the newly added column. Is there a vba to do this so that it takes in the form name and table name as arguments and returns a list of columns that are in the table but not in the form itself  for example –
Function ShowNotinForm (myTblName,myFormName)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
test this code

Function ShowNotinForm(myTblName As String, myFormName As String) As String
Dim strFields As String, rs As DAO.Recordset, j As Integer, db As DAO.Database
Dim ctl As Control, strControlSource As String
Set db = CurrentDb
DoCmd.OpenForm myFormName, acDesign, , , , acHidden
For Each ctl In Forms(myFormName).Controls
    If ctl.ControlType = acTextBox Then
        strControlSource = strControlSource & "," & ctl.ControlSource
    End If
DoCmd.Close acForm, myFormName, acSaveNo
Set rs = db.OpenRecordset("select * from [" & myTblName & "] where 1=0")
For j = 0 To rs.Fields.Count - 1
    If InStr(strControlSource, "," & rs(j).Name) = 0 Then
    strFields = strFields & "," & rs(j).Name
    End If
ShowNotinForm = strFields
End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RayneAuthor Commented:
Hello Rey,

I need it like this >> Grab all the table column names first and check if it’s in the form or not…..
What you did is >> grab all the form column names and see if it’s in the table or not…
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.