Form Caption

B

Bob Betts

How do I make a caption of a form refer to a value of a certain field on
another table.

Example if my company name is ACME stored in a table entitled company
information / company name... I would like it to appear in all captions in
all of my forms.

Thanks..
 
A

Alex White MCDBA MCSE

Hi Bob,

in the form_open event for each form

Private Sub Form_Open(Cancel As Integer)
Me.Caption = Me.Caption & " " & Module1.GetCompany
End Sub


Module1

Public Function GetCompany() as string
dim adoCompany as new adodb.recordset
GetCompany = ""
with adoCompany
.open "Select Company_Name from Company",currentproject.connection,
adOpenKeyset, adLockOptimistic
if .recordcount > 0 then
if not isnull(.fields("Company_Name").value) then
GetCompany = .fields("Company_Name").value
end if
end if
.close
End function

The above should do the trick post back here if you need more help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top