Combo Box Data Row Source

  • Thread starter Thread starter kenrav
  • Start date Start date
K

kenrav

I recently upsized my BE to SQL Server 2008 Express. As expected, my new
tables all have a "dbo_" prefix. I can easily do a 'Search & Replace' in my
code to accommodate the new names. However, I have a great many combo boxes
which reference the original table names in the Data Row Source property that
need to be changed. Does anyone know how to do this universally or do I need
to change each one individually? Thanks.
 
Why not just rename your linked tables?

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb()
For Each tdf In db.TableDefs
If Left$(tdf.Name, 4) = "dbo_" Then
tdf.Name = Mid$(tdf.Name, 5)
End If
Next tdf

Set tdf = Nothing
Set db = Nothing
 
Works great! Thanks!

Ken

Douglas J. Steele said:
Why not just rename your linked tables?

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb()
For Each tdf In db.TableDefs
If Left$(tdf.Name, 4) = "dbo_" Then
tdf.Name = Mid$(tdf.Name, 5)
End If
Next tdf

Set tdf = Nothing
Set db = Nothing

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 
Back
Top