Re: Programmatically update forms in design view

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Opening forms in design view is not a good solution. It will prevent you creating an MDE, so at some point in the future, will stymie you.

If you want to do it anyway, make sure the form is not already open before you open it in design view.

Particularly if you already have the information you need in a table, this seems like an unnecessary approach. You might investigate whether the ID of the MSysObjects table could already give you a unique identifier for each form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Biz Enhancer" <BizEnhancer@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7204FBBE-54E8-4E05-8624-AEFD326B402B@xxxxxxxxxxxxxxxx
Hi,
I have a problem with updating a label on multiple forms.

The scenario is that on each form I have a non-visible label that has a
number for its caption value.
Each form has a different number. This label named "fmno" supplies error
logging as well as a user rights functions.
The problem is that when I import forms into a new application I wish to
update the fmno.caption value programmatically by creating a recordset and
opening, updating, and closing each form in the recordset. I can't open the
forms in a Normal view as the fmno.caption value is incorrect and prevents
the form from opening (security routine on Form.Open). I can't pull the value
through on form.open as this would substantially weaken the security aspect.
Therefore I am trying to do this via the Design view. Code as follows:
********Code Start************
Private Sub Command15_Click()
On Error GoTo Errtrp
Dim Erm As String, fm As String, MyDB As Database, rs As Recordset, e As
String, k As String, t As String
fm = Me.fmno.Caption
Erm = "F" & fm & "/C15cl"
Set MyDB = CurrentDb()
Set rs = MyDB.OpenRecordset("SELECT frmtbl.jid, frmtbl.title FROM frmtbl;")

While Not rs.EOF
e = rs.Fields(1)
k = "" & rs.Fields(0) & ""
t = "" & e & ""
DoCmd.OpenForm e, acDesign, , , acFormEdit, acWindowNormal
Forms(t)(fmno).Caption = k
DoCmd.Close acForm, e, acSaveYes
rs.MoveNext
Wend
Exittrp:
Exit Sub

Errtrp:
Call faulttrp(Erm, Err.Number, Err.Description)
Resume Exittrp

End Sub
****Code End**********
Running this I get an error 438 "Object doesn't support this property or
method"
Any ideas on how to get around the problem?

Appreciate any help.
Thanks,
Nick.

.



Relevant Pages

  • Re: Search CSV for string.
    ... Don't know if it will suit your requirements and not sure if speed is important, but you could probably speed this up a lot by opening ... Sub GetSingleFile() ... Dim FileName As Variant ... Sub ReadCSV(ByVal myFileName As Variant, ByVal SearchData As String, ByVal ...
    (microsoft.public.excel.programming)
  • Re: is it possible to get delegates from properties directly?
    ... If your design truely needs the delegates & using a string to retrieve them ... Public Property Name As String ... Public Sub SetName ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Rename Excel Spreadsheet
    ... Sub FileRename(strFrom As String, strTo As String) ... >need to rename the file before opening it and am having ...
    (microsoft.public.access.modulesdaovba)
  • Re: Executing an SQL Data Definition Query
    ... Find out the proper name (e.g. by opening the table in design ... view) and use that in your query. ... >How do I get the database sorted by string length??? ...
    (microsoft.public.access.gettingstarted)
  • How to disallow additions in form
    ... Sub OuvreForm(..., destFormName As String, ...) ... and I don't understand why the form keeps opening with the * navigation ...
    (microsoft.public.access.forms)