Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / October 2007

Tip: Looking for answers? Try searching our database.

Increment form open cbo from unbound table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Maarkr - 29 Oct 2007 17:22 GMT
I have twenty forms that need to open and close in order (increment by 1)
using an On_Click event. I added a table named TableOfForms with a FormNo
field (in opening order) and FormName Field.  I got the form that is open to
get the current form name and number , but now I can't figure out how to open
the next form number in the TableOfForms...it is not bound to this
form...tried a couple of ways but my little brain is just not getting there
today.  Thought I saw a post where you can't open a form from a table?? Do I
have to open a recordset to get the value? I'm not very good at that level
yet. Thanks for any help.
       
intFormNbr = DLookup("FormNo", "TableOfForms", "Form.Name =[FormName]")
intFormNbr =  intFormNbr  +1

DoCmd.Open Form "get the formname from tableofforms.column(1) where
intformnbr = tableofforms.column(0) aaaaarrrrggggg!"
Wolfgang Kais - 29 Oct 2007 20:52 GMT
Hello Maarkr.

> I have twenty forms that need to open and close in order
> (increment by 1) using an On_Click event. I added a table named
[quoted text clipped - 12 lines]
> DoCmd.Open Form "get the formname from tableofforms.column(1) where
> intformnbr = tableofforms.column(0) aaaaarrrrggggg!"

You could simply get the name of the form with a DLookup:
DLookup("FormName", "TableOfForms", "FormNo=" & intFormNbr)

And of course, you could use a recordset instead:

Dim strSQL as String, strNextForm as String
strSQL = "Select FormName From TableOfForms Order By FormNo"
With CurrentDb.OpenRecordset(strSQL, dbOpenFormwardOnly)
   .FindFirst BuildCriteria("FormName", dbText, Me.Name)
   If Not .NoMatch Then
       .MoveNext
       if Not .EOF Then strNextForm = !FormName
   End If
   .Close
End With
If strNextForm <> vbNullString Then DoCmd.OpenForm strNextForm

Signature

Regards,
Wolfgang

Maarkr - 30 Oct 2007 19:36 GMT
The old "double DLookup" trick.  new it wasn't too hard...thanks

> Hello Maarkr.
>
[quoted text clipped - 31 lines]
> End With
> If strNextForm <> vbNullString Then DoCmd.OpenForm strNextForm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.