Sharing Values/Variables Between Forms
Jun 26, 2007
Is it possible to access the values on one form and use them on another? For example, I have heard that the code might look something like this:
Form1.Text1.Text
When I've tried this, it doesn't work. Someone mentioned something about declaring them as Public, but they're not variables, they're actual record values on another form. Any suggestions?
Thanks!
Mike
View Replies
ADVERTISEMENT
Nov 29, 2004
Hi ya,
Still working on a products catalog. I am creating this by printing a couple of separate reports, each with its own category.
At the end of a report A I store a value (number of pages) into a variable "NumPage", defined in Visual Basic. I have made this variable public and also the sub in which it is altered (report_close()) is public.
Now I should have stored the number of pages of report A in NumPage, enabling me to start report B with the right page. However in the public sub (on_open()) of report B I am not able to display the value of NumPages (just using a messagebox to check if it works).
Does anyone know whether it is possible, and if so in which way, to pass a variable created in a module of report A to report B?
Cheers,
Thomas
View 1 Replies
View Related
Jun 7, 2005
i have a form (frm1) and subform (sfrm1) that when a room number is double-clicked in the subform another form (frm2) and subform (sfrm2) loads. frm1 has building info and frm2 is used for inspection info. if a room has never been inspected then when frm2 loads the field [room] will be empty. however, after the first inspection the room number is obviously entered for frm2.
so i have created a global variable that holds the value of [lab_room] from frm1 and is supposed to use this value on frm2 if the room has never been inspected - ie, [room] is null. however, the value of intRoom (global variable) is lost after is leaves frm1 and goes to frm2. below is my code:
modGlobal (module with global variables declared)
Option Compare Database
Global intVar As Variant
Global intRoom As String
Private Declare Function CoCreateGuid Lib "OLE32.DLL" (pGuid) As Long
Private Type GUID 'Memory structure used by CoCreateGuid
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Const S_OK = 0 'Return value from CoCreateGuid
frm1 subform double click event
Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
Dim stMsg As String
'if the user double clicks on an area that has no lab_id associated with it
'prevents a null value for lab_id
If IsNull(Me!lab_id) Then
stMsg = "There is no lab associated with this room."
intRes = MsgBox(stMsg, vbOKOnly + vbExclamation, "Error - No Lab Selected")
GoTo Exit_DblClick
End If
'opens lab forms associated with this lab_id
intVar = Me!lab_id
intRoom = Me!lab_room
stDocName = "ehs_lab_safety_surveys"
stLinkCriteria = "[lab_id]=" & "'" & intVar & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
[Forms]![ehs_lab_safety_surveys].Form.RecordsetClone.Find ("lab_id = '" & intVar & "'")
DoCmd.Close acForm, "copy_lab_search_by_bldg"
Exit_DblClick:
Exit Sub
Err_DblClick:
MsgBox Err.Description
Resume Exit_DblClick
End Sub
frm2
Private Sub Form_Load()
Dim strNewguid As String
'checks for null values of lab_id, room, id and safety_survey_date. if they are
'null or empty a value is inserted.
If IsNull(Me!lab_id) Or (Me!lab_id = "") Then
Me!lab_id = intVar
End If
If IsNull(Me!room) Then
Me!room.Value = intRoom
End If
If IsNull(Me!safety_survey_date) Then
Me!safety_survey_date = Date
End If
If IsNull(Me!id) Or (Me!id = "") Then
Set x = CreateObject("Scriptlet.TypeLib")
strNewguid = Left(x.GUID, 38)
Me!id.Value = strNewguid
End If
DoCmd.Maximize
End Sub
can anyone see why the value is being lost from frm1 to frm2? i'm ripping my hair out trying to figure this one out....
View 12 Replies
View Related
Sep 28, 2014
Is this how to share a variable between two (2) forms ?
Form #1
Form1_Popup
Public Var1 As Integer
Form #2
Form2
Public Var1 As Integer
GotIt = Var1
View 4 Replies
View Related
Mar 5, 2013
I created an access 2010 file containing tables and 2 linked forms to distribute to different people so that they can enter data for a project. The problem I am having is that the people receiving the file aren't able to open it, different error messages pop up:
-accessde.dll missing
or
-vba6mtrt.dll missing
Is there a way to export the access file so that regardless of the program, they are able to open the file? if not, what are the solutions to this?
View 1 Replies
View Related
Jan 13, 2014
I need to get an average of 2 variables eg.
target low eg 4
target high eg 8
target (to have the avg) result 6
I have been doing the following but dont work ..
=Avg([Target Low].[Target High]) result #error
=Avg([Target Low]+[Target High]) result 12
=Avg([Target Low]&[Target High]) result 48
=Avg([Target Low]:[Target High]) will not work
View 1 Replies
View Related
Sep 28, 2006
Before I go any further w/this current application, I want to make sure this will work.
I have an access database w/a few forms that will sit on a shared drive on a network. Each user will also have their own username and password because each user will have a certain level of access to what they are allowed to see. The problem I am facing is that if I put the users ID into the global variables module, and two users log on at the same time, then access seems to somehow use both of the IDs when running queries. This makes sense that all uses can see it, since it's Global... but I need a way for simultaneous users to have a persistant unique id so I can query data that's only meant for them. I found this example of code that might remedy the situation by passing variables between the forms.
Call the code below in frmOne to pass the variable.
DoCmd.OpenForm "frmTwo", acNormal, , , , acWindowNormal, "Count=2"
Call the code below in frmTwo to get the variable.
Dim i as Integer
i = CInt(GetTagFromArg(Me.OpenArgs, "Count" ))
Will I end up w/the same result? Will all users be able to see this variable as well?
View 6 Replies
View Related
Sep 30, 2013
I have a simple date stamp that works great in a private sub within a form. (error handling removed for clarity)
Code:
Private Sub btnDateStamp_Click()
' UserInit is global variable
Me!Notes.SetFocus
Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & UserInit & _
" -" & vbCrLf & Me!Notes
[code]...
I am rewriting it as Module function that is Called from various forms, to save space. The function receives the parameters varFormName and varControlName. I wish to write the results of the function back to a memo field on the form.I am stumped at the get go by the need to refer to the Forms controls with a full reference instead of the Me command.
Code:
Function DateStamp(varFormName As String, varMemoName As String)
'varInitials, varFormName, varMemoName are global variables
Forms!varFormName.Controls!varMemoName.SetFocus ' Error here
'Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & varInitials & _
[code]...
how to refer to the forms control's with their full reference, from within the Module's function, the rest will fall into place.
View 3 Replies
View Related
Aug 31, 2013
I'm using Access 2007.
I have a customer table attached to a form.
I want to put a command button next to the customer's email address so that the user simply presses the button and Outlook will be started with the customer's email address automatically inserted from the table.
I am playing around with the Hyperlink Address function and whilst this seems to do what I want, I can't figure out how to get the customer's email address from the tabel and insert it......
View 13 Replies
View Related
Sep 2, 2013
I've inherited an Access 2010 database that needs tweaking. I have a form, let's call it CALLED_FORM, that is loaded from various places - ie there are quite a few places that do the following
DoCmd.OpenForm "CALLED_FORM", , , , , , coupleofarguments
This works great when called from most places but if it is called from 1 specific form there is a likelihood that some code is executed that shouldn't be.
So I want to be able to do the following
In CALLED_FORM I want to be able to skip some code if the previous form is say FORMX. For all other forms I want it executed. E.g.
If PREVFORM <> "FORMX" then
code
more code
even more code
End If
Is there a system variable for PREVFORM.
I know I can change coupleofarguments to threearguments and pass something over in that to show which form it has been called from but that is a bit difficult.
View 3 Replies
View Related
Sep 17, 2013
In Access 2010 I have a Data Entry Form on which I have an unbound textbox in the header that the user can put a default date in. In the body of the form is a bound textbox that records the date and the default value is set as =defaultdatestat (obviously the name of the box in the header).
Problem: The default date shows up perfectly until a value is put in any of the other text boxes.
For further info : If you put values in text boxes default value disappears; if you then push escape the default value reappears when the values in the text boxes disappear.
View 4 Replies
View Related
Nov 22, 2013
I have several result fields which are all drop down lists. I want each result field's drop down list values to be different depending on the selected value of the Test1 drop down list.I came up with using the .rowsource keyword. My syntax seems to be fine but I'm not getting any values under the result fields when I run the form.Here is my code so far:
Private Sub Test1_AfterUpdate()
If Me.Test1 = "Stress Echo" Or Me.Test1 = "Stress SPECT" Or Me.Test1 = "Stress PET" Or Me.Test1 = "Stress MRI" Then
Me.Test1Result2.RowSourceType = "Value List"
Me.Test1Result3.RowSourceType = "Value List"
[code]...
View 14 Replies
View Related
May 3, 2005
I'm new to Access. I've created a master table called "People". It contains all data of all people. There are different types of people and their values (and a people code that I created) distinguishes their types. One type of person (a customer) has a value called "ProjectNature". I created a "ProjectNatureTable" that contains project nature codes (PTF is Pressure-Treated Fence; CD is Cedar Deck, and so on). When editting the "People" table, users can pick the projectnature code from the combo box, and the ProjectNature value appears in the People table for that customer.
Table 2 is my "Project Initiation" table. It needs to be able to plug in the "ProjectNature" value from the "People" table for existing customers. All Access will let me do is pick the ProjectNature from the combo box list. It won't read the value that's in the People table for each customer. I don't want my users to put in a Project Nature code in the Project Initiation table, in case they pick the wrong code for that customer.
How do I get my 2nd table to read the value (not the combo box) in the ProjectNature field in the People table and automatically put it into my 2nd table?
View 1 Replies
View Related
Aug 13, 2005
Hi there,
I'm working on a small database for my girlfriend and I to use for tracking some products for a home business.
We are the only two who will use it.
I've created the database in Access 2000 on windows XP pro with sp2.
Everything works great in the database.
Problem is sharing it. I shared the folder I created the database in (c:databasesite) ... In the folder is "products.mdb" and a folder called "Images"
Basically, I just want either of us to be able to open the mdb file and enter new data/make changes/whatever... both users need full access.
The shared folder has permissions set for both users to be able to read/write.. and both users can read/write to the folder.
BUT... when my gf tries to open the .mdb file from her pc, she gets a message saying that it's already open exclusively by another user. Only thing is, no-one else had the file open at the time.
The database is set to open in shared mode by default, so that's not the problem.
I can even go one step further to say that if I copy the .mdb and images folder to the default windows "Shared Documents" folder, everything works peachy for both users... both can get in and edit stuff... even at the same time... so why the heck wont it work in any other shared folders?
Is there some step i'm missing with this one?
Plz help!
View 1 Replies
View Related
Mar 14, 2006
Im not sure how to go about this, so I need plenty of advise. The Database I have built is, at the moment on a number of laptops, none of which are contected to a network. If things go according to plan the DB will eventually go on to the desktops which are conected. the aspiration is that the DB will be on one main PC with all others accessing it. Problem is I have never done anyting lke that before and am unsure where to start. alny advis gratfully received. Thanks!
View 4 Replies
View Related
May 11, 2007
hello,
I am working on an ACCESS database. I saved it in my computer "A" on a "shared" folder. Now I want somebody else to be able to modify the tables when I am working on the database and when I am not in my office from a different computer "B". Both computers are on the same network. The problem is that when I try to open it from computer B it gives me a read-only message. How can I accomplish this??
Thank you
View 1 Replies
View Related
Sep 18, 2007
Hi Guys,
This might sound like a stupid question but I'm just trying to work through it in my head and I don't want to miss something, so a couple of new pairs of eyes might just clarify.
I've created a call monitoring database for a call centre and I have split this so that they have a front end and a back end as per someones instructions. They have done the normal thing in as much as just putting a shortcut on everyone's computer so that they are all trying to access the one front end instead of putting a copy of it on everyone's machine. I've got a feeling they are going to ask me to go in and put it right, so when they have put a copy on everyone's machine will that automatically link to the back end or do new links have to be made, if so how would I/they do this? - is it done from each computer?
I don't really know, I'm just assuming that's what needs to be done but I don't want to tell an IT team that what to do if it's not.
I've only ever set up a sharing database once before and that was built on the company network and I set it up on each computer in the department, but they weren't doing data entry it was only for interrogation purposes and it was a few years ago now so I'm rusty, but I do remember it took me a long time to do.
Thanks for any help.
Donna
View 8 Replies
View Related
Oct 8, 2007
Am new too this forum and I dont know whether this is the place to place this post. We want to share a database with my boss. I dont want to split it yet and make an MDE because am still working on it how do i share it
Also anyone with an idea where i can get a clothing shop database sample
View 1 Replies
View Related
Dec 3, 2007
Hi
Windows XPPro SP2
Access 2002
I'm a little ... ahem ... confused?
I'm trying to share out a database using the FrontEnd (FE) BackEnd (BE) concept. I've had an unexpected result however. I've made two copies of the FE, one resides on the same machine as the BE (but in a different directory), the other FE resides on a remote machine.
I carried out an experiment whereby I updated the same record from each of the FEs but using different data (some free-text in a textbox). I was expecting to see the record displaying the data from later of the two entries... but both FEs show their own version of the record in question?
Here's how I split my Db.
1. Whilst on the PC remote to the intended network share, converted the original Db to Access2002 (from 2000 format).
2. Again, on the PC remote to the intended network share, used the Database Splitter in "Tools" where I set the target directory for the BE.mdb to be on the network share.
3. After some fiddling with "Trusted Sites" in IE's options(?), got the FE on the PC remote to the network share to finally connect (or so I thought) to the BE.mdb.
4. Placed a copy of the FE onto the PC owning the network share (but in a different directory).
5. Used the "File" / "Get External Data" / "Link Tables" to link to the BE.mdb
6. After some minor "compile" errors, the 2nd FE seemed to fire up OK.
The two FEs seem to be using their own copies of the tables?
I guess I've missed a step somewhere? can one of you kind people out there educate me please? - Any help as always greatly appreciated... Thankyou.
Regards
P.S. I've noticed that .ldb locking files appear in the same directory(ies) as the FEs... I was rather expecting the .ldb to be on the same share as the BE.mdb?
Thanks
View 2 Replies
View Related
Feb 21, 2005
Well, I am mostly done with my database design and I want to share it out on the network. As I have stated several times before, I am not a programmer, so if I explain how I have tried to do things badly, you'll know why.
1st, I tried just moving my database out to a shared file within my office. That worked, as for as them being able to see everything but any changes they made to tthe database, from their pc, didn't save to mine. So...
2nd, I created a new network drive and mapped the other persons pc to my IP address and then shared to database onto the new drive. That loaded up Access but it wouldn't open the actual database because..."this file is located outside your intranet or on an untrusted site".
After talking with my network administrator, he feels that the problem is within the security settings of Access but he is unfamiliar with Access.
Does anyone know why I am getting this message from the opening the network copy of this database?
View 10 Replies
View Related
Feb 1, 2007
I'm currently having problems with splitting my database.
The situation as present it:
- I have a shared folder on my laptop, to which i have given full permission rights to a collegue, in this folder is the backend of the db which i split from a database also sat in the shared folder
- I can then go to the front end of my database either on my desktop or shared folder and update tables
- However, this is where the problems start. The copy of the front end that my collegue has (an exact replica of mine) cant access or open any tables. Even if he opens the exact front end that I'm successful with in the shared folder. The following error message appears
"Could not find the file 'D:Testdb_be.mdb'"
the D drive on my computer is where the shared folder 'test' is stored.
Any hints or advice on why this isnt working?
Thanks in anticipation
Ross
View 3 Replies
View Related
Jun 9, 2005
I have an access database that I used to be able to share between 5 different people (we were all able to input data at the same time) Something has changed and now only one person can get in to work on it at a time. If someone else tries it tells them that it can't find the database. Has anyone seen this before and if so what's the fix. Any help would be greatly appreciated.
View 2 Replies
View Related
Jan 20, 2006
Goal
I'm trying to trying to setup a MS Access database on a shared server drive where all of the main tables are linked via ODBC into an SQL database. The SQL database is updated and maintained via purchased application. It appeared that MS Access security could be used to control the type of access each user has. Most of these users will have read only access for reporting purposes since the main application is used to update and maintain the data.
What I've done.
1) I've setup ODBC Access for each user. Not sure if this should be User, System or File DSN. They all work and I can't tell at this point that it makes a difference.
2) Created the MS Access Database, created users and assigned security.
3) Linked the needed tables.
Problem
1) When I had a user try to access a table it said "Table definitions not defined". What I then realized is that the MS Access on there machine was picking up their default security. A security Table and a shortcut (.mdb1 file) that pointed to the correct security and table definitions.
2) Now when the user gets in everything seems to come up fine but when they try to go into a table they get an error saying they don't have permissions. If I relink while they have it open, they can get into the table just fine. However, they can't delete the old tables because they have 'Read only' access. I don't really want to have to relink all the tables for each user, I might as well to go to each of their machines and set them up individually...not a good idea.
What now?
This seems like something that should be fairly easy to do..what am I missing?
View 5 Replies
View Related
Feb 19, 2007
hi everyone,
i have designed a simple database which need to be accessed by 3 different people(number likely to increase) located in different towns.what do i need to do especially from a technical point of view.
Thanking you in advance.
View 5 Replies
View Related
Mar 21, 2007
Please forgive me if I have missed a post on this. I spent the last few hours searching here and the internet for some things to try.
We currently have three computers running a database. Each of them has a front-end and a back-end is located on my computer. All front-ends are linked to the back-end. The two remote computers are using 2007, my computer is still using 2000. Only recently has the OS been ungraded on the remote computers, but the networking/sharing problem was around then as well.
We are using a wireless-g connection. All computers have mapped the network drive to my back-end share. On one remote computer(#2), the password to access the mapped drive is not saved (an unrelated issue), but she could access and edit the database while I was doing the same.
On the other remote computer (#3), they can only use the database when it is not in use by me (computer #1). And when #3 has it open, it locks out everyone else. With #3 opening it first, it puts me on "read-only, not updateable" status and it puts #2 on similar or worse.
When I have the database open first, #3 cannot access the backend at all. She gets "file is in use by another user" or something to that extent.
The back-end is set to Shared, No Locks and "Open database with record level..." checked.
At this point, we would like to set it up so that ONLY I can enter/delete/edit data and all remote computers can read but not change. I have tried a number of things, including some Windows XP permission changes, but nothing seems to work.
Any help would be great. Thanks
View 3 Replies
View Related
Dec 28, 2004
i have an Access form which is in local drive of each computer on the LAN. This form has the tables linked to Excel spreadsheats which is on the LAN nw...so that all users can get the data for thier Access form from the same excel database. (every user has his/her own Access form but share one excel-database) I have made the Excel sheet to share the workbook (by tools--> share workbook) to allow changes by more than one user at the same time.
This works fine with one user at a time.
But does not allow multiusers at the sametime.. ie.. two people cannot use the form at a time...the second user who is trying to get the access form will get a message saying that the excell spread sheat is open exclusively by another user.
I know that i can copy the excell spread sheat to each computer and access it from there... but I would like to have one database in the LAN..so that i just have to update this whenever the data base needs to be changed.
Hope im not wasting ur time
soni
View 1 Replies
View Related