473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pass a string get a form

Whew, it's been a while since I posted. Fogive me all for I have...

anyway.

I would like to be able to write a method of an object that could
accept a string and set the corresponding form. It an easy thing to
do if I am talking about a recordset. I could simply loop through the
recordset collection, find the one that I wanted, and then set my
object to the one that I found.

But forms are seemingly different. The code out there demands that a
form either be open or in design view. That would totally defeat the
point of what I am trying to do. From what I find in help, if I want
to loop through all of the forms open or not I have to go through the
documents collection. That is fine, but when I find the form I want,
I am still left with a string variable that I want to set to a form,
and that just won't work. You need a text literal to set an object to
as far as I know.

Public frmName as form
Public sub setThatForm(StrFormName)
WHAT GOES HERE?

end sub
Nov 12 '05 #1
1 1934
If you want to do something like DoCmd.OpenForm... for a certain
condition, looping through the document collection may not work since I
believe the form has to be already up and running (for which
DoCmd.OpenFormm... would not be an issue). But if this is something you
had in mind, you could hardcode the list of forms in your DB into an
array (variant array) or list them in a table. If you just want to
access a running form, then looping through the document collection
should get all the open forms. If you want to pass a form object to a
procedure try this:

Sub frm1()
Dim frm As Form
Set frm = Forms!frm2
Call Procfrms(frm)
End Sub

Sub Procfrms(f As Form)
Dim str1 As String
str1 = frm!List1.Column(0)
...
End Sub

Or something like that (of course, in this example it would be easier to
pass whatever was selected in the listbox (List1)). Or maybe you want
to pass the form object to a class object to disable all the controls on
the form while a procedure is running.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Matt | last post by:
In ASP, when we pass data between pages, we usually pass by query string. If we pass data by query string, that means we need to use submit button, not by regular button, and the form will pass to...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
6
by: NewToCode | last post by:
I built an application aroung the FileSystemWatcher and i am having trouble passing a string from my mainForm to a second form toastForm. Can someone please give me some insight on how to do this....
3
by: Hei | last post by:
Hi All, i using .showdialog to show a child form for user input some data, and i wand to pass back these data to the parent form. how can i achieve this? thx. Hei.
6
by: juky | last post by:
Hi all, I have 2 applications one in VB.net and the other in VC6. I need to pass data between them. How can I do it? what's the best way to implement such communication ? Any comment will be...
3
by: Brad McMillan | last post by:
Hi: I have MS C# 2005 Express Edition and I'm trying to pass a string to a new form in my project. First I created the form, Customer, with a textbox, "textBox1", and declared a string...
4
by: rlntemp-gng | last post by:
I have one module where I would like to launch 2 different forms (that do exist), based on a form object and string that is passed into it. (prmTable is a string, not a table object simply because...
13
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.