Popup Box - Setting Up A Combo Box To Update A Variable
Oct 7, 2005
hello,
newbie needs help!!!
I have a globally defined variable (gsUser) which I defined in a module.
The idea is that when one of my users creates a record then , I will update a column called "Created by" with the current users value.
The issue is how to get the current user name.
In my main form , in the "beforeinsert" and "beforeupdate" events I have triggered a call to a function in my module (function WhoAreYou)
This function checks the value is gsUser and if blank it then does a DoCmd.OpenForms to my popup form.
The popup form needs to contain a combo box whoses recordsource is pointing at a table of users I have created BUT whose source control is not pointing to a table of any kind.
How can i set up this combo box so that a user can be selected, but the selected user then populates a variable instead of a data column??
I would then user the variable to populate gsUser.
if you could give me an example I would be gratefull
Alternatively if you can think of another way of making the user pick his name from a list of usesr before updating data I would be glad to here it
Thanks in advance for your help
MartyK
View Replies
ADVERTISEMENT
Jul 26, 2015
I have a form (Access 2010) in which i insert contracts; each contract has a start and an expiry date, but instead of dd/mm/yyyy i would like the user to be able to insert just the year, while the day and month are predefined values and they are automatically inserted (i.e. 01/10/yyyy; the year being the only value that changes, and it is manually inserted by the user).
I would like to set a pop up remainder (on form load) x days before the expiry date, but, because too many of them have the same expiry date i am wondering if the reminder can be set on different days, based on another field (i.e. partner location [country]).. i.e. reminder for contracts with Austria to pop up 60 days before expiring, for UK = 67 days and so on.. or even a specific day for each, i.e. for Austria = 01/08/yyyy, for UK 01/09/yyyy).
View 2 Replies
View Related
Aug 20, 2014
I look at a lot of files to see when they were last updated. I wanted to write a generic procedure to manage that so ..
Code:
Public fDate As Variant
Public vField As String
Public vFile As String
'GTSdata
vField = "txt_gts_data"
[Code] ....
What I hoped Me.vField would do is update the date field [txt_gts_data] on my form with the date the file was last saved.
i.e. me. txt_gts_data = fDate
What actually happens is the variable vfield gets updated from "txt_gts_data" to 19/08/2014 then later code falls over because the fieldname is lost .
Me.[vField] corrects itself to me.vField (and does not work)
Me!vfield falls over (cannot find the field vField, not surprising J)
How do I say update the contents of the variable, not the variable itself?
View 7 Replies
View Related
Jan 21, 2015
I have the following simple variable assignment...
Dim PolRef As String
Let PolRef = Me.Policy_Ref_Num
But when I run my code I get "Invalid Use of Null" and PolRef is set to ""
This field is populated however, so I'm confused to why I cant set my variable to it.
If I don't use a variable and simply have let XXX = me.Me.Policy_Ref_Num then it still wont return the value from the field.
View 5 Replies
View Related
Jan 5, 2005
This is the first time that I have done any major work with forms. After I thought I had finished a problem came up. There are several forms that are use to input information into a table. When the form is opened it grabs an automated number for tracking. The problem is, that if the form is opened and then closed it creates a line of data with all null values.
What I would like to do is have the form open, the user fills out the information, and upon pressing the "save" button, the data will save to the table. I think I need to have each text box write to a variable and then save on the click event. Or I could be completely wrong and need to do something else.
i'm guessing this is something I would learn in Forms 101 if i had ever taken that type of course
Thanks
View 7 Replies
View Related
Aug 7, 2014
Is there a way to make a popup list open on click of a button (cmdAssign) and the user chooses/selects something from the list, then the popup closes and the textbox (txtAssignmentNo) is filled with the choice?
View 3 Replies
View Related
Jan 27, 2015
I'm having a little difficulty setting up a combo box to filter another combo box. I've actually got one working but the second one is giving me all sorts of errors. On the attached database, there's a form called frmAddNewRecord. At the top of the form there's a combo box which allows you to select a name and another combo box beside it which acts as a filter so only names from a certain section are shown (working fine).
The subform which is attached to this form and contains the training details, has another combo box which allows you to select a job...I've tried to add a combo box beside this to filter it but I can't get it to work.
View 5 Replies
View Related
Feb 18, 2005
I have a form with a query based bound combo. The same combo can be found on another form which can be launched from the original form. I want to update the combo on the original form with the same value as the combo on the launched form (after update).
In my after update event I have the following code;
[Foms]![form1]![Combo1] = Combo 2
This doesn't seem to work (I don't get an error but Combo1 doesn't update).
Any ideas?
View 2 Replies
View Related
Sep 1, 2006
Apologies if this is a basic question. Here's my situation:
I'm trying to update rows in a table based on a count of items in the same table. The table in question contains order line items. On each line item, I'd like to store the total number of items attached to that order (because it affects how the individual line items are processed).
I have a query that seems like it should do the trick, but Access doesn't like it:
UPDATE sales AS S1 SET S1.EXPC = (select count(*) from sales S2 where S2.order_id = S1.order_id AND S2.product_code = "EXPC");
Here's the error I get:
Operation must use an updateable query.
Thoughts?
View 5 Replies
View Related
Jul 22, 2013
I am currently trying to create an update query (building a SQL String in VBA for a command button click event) to update a variable's value into a table.
Basically, there are 2 tables, displayed in 2 sub froms within the same main form. (OldTable and NewTable for arguments sake)
The basic method I want to implement is that a user highlights a record in the subform of "NewTable". (This value is stored as a variable "NewJPNUM" This value is then to be inserted into the highlighted row (or rows) of table OldTable on command button click.
So the basic idea is a user highlights a row in one table and this value is stored as a variable "NewJPNUM" . The user then highlights a row or rows in "OldTable" and the value from variable "NewJPNUM" is then written to field "NewJPNUM" in "NewTable" on command button click.
I am not experienced with Access but have decent experience in Excel / VBA so not really sure of best practice methods etc.
View 3 Replies
View Related
Jul 10, 2005
:confused: I was wondering if somebody can help with my default combo box problem?
I have a secured database whereby users logon, which is used as a scratch pad for keeping track of Purchase orders. A Form frmUserInput with two relevant fields for this problem 1. User Initials txtUsersInitials and 2. POBook (Purchase Order Book) which is the combo box cboPOBooks both unbound fields on the form.
The txtUsersInitials is generated automaitcally when the form is loaded using a VBA statement txtUsersInitials = Current User.
The list of the combo box is generated from a table tbleUsersPOBook and uses a query qryUsersDefaultPOBook as listed below;
SELECT tblUsersPOBook.UsersPOBookName
FROM tblUsersPOBook
WHERE (((tblUsersPOBook.UserName)=[Forms]![frmUserInput]![txtUsersInitials]));
This generates a drop box showing the Different department codes for each individual. So for some it is only one item for others up to three codes, this part works fine... :)
:cool: However here is my problem.
Since some people can sign off more than one Purchase Order book I have had to add an additional field in the table tblUsersPOBook called DefaultUsersPOBook which is a yes/no field, so only one yes exists for each user who logs on. I have created another query qryDefaultPOBook as listed below;
SELECT tblUsersPOBook.UsersPOBookName
FROM tblUsersPOBook
WHERE (((tblUsersPOBook.UserName)=[FORMS]![frmInputForm]![txtUsersInitials]) AND ((tblUsersPOBook.UsersPOBookDefault)=Yes));
When I place this query in the Default section of the combo box it gives me no result.
Firstly is it possible to have a varying default like this since each user will have a different default?
Or is there maybe a better way of achieving a default which is variable for each user based on thier default Purchase order book in the table tblUsersPOBook for the field "Yes" in DefaultUsersPOBook ? :confused:
View 8 Replies
View Related
Aug 28, 2007
I am trying to create a table to show the parent/child relationships between assemblies, sub-assemblies and detail parts. The table I start with has 2 fields a "Part Number" and an "Indenture".
Please forgive all the periods, couldnt think of how else to seperate the values to depict the tables.
Example:
IND..PN
00....A
01....B
01....C
02....D
03....E
03....F
01....G
00....H
01....I
02....J
I can get the first step to completeing the new table of parent/child relationship like this:
PN....00....01....02....03
.A.....A
.B....."".....B
C......"".....C
D......"".....""......D
E......"".....""......"".....E
F......"".....""......"".....F
G......"".....""......""....G
H......H
I......""......I
J......"".....""......J
Where "" are null values
My problem is making it so that every part number has its own array, aka [family tree], so that for part "F" the table would hold "A,C,D,F"
I though an update query where for example:
*"Zero" is a single field string.
IIF([00]<>null(), Save [00] to Zero, Write Zero to [00])
Would work but have been unable to find any information about passing a field value to a variable for later use or comparison. I would have already done this in excel if the table had less that 65000 records.
Example of final table:
PN....00....01....02....03
.A.....A
.B.....A.....B
C......A.....C
D......A.....C......D
E......A.....C......D.....E
F......A.....C......D.....F
G......A.....C......D....G
H......H
I.......H......I
J.......H......I......J
Any help is greatly appreciated.
BsK
View 1 Replies
View Related
Aug 21, 2006
i have a combo box on my form that uses UNION query to put "<select>" as part of the list items.right now "<select>" appears on top of the list but what i mtrying to do is when the form loads i want the combo box to have "<select>" selected and not just show blank unless someone click on the down arrow. i m sure there is a way/propoerty to do it but i cant figure it out. Also how can i make my combo box so user cant type in a combo box but select from the list.
View 2 Replies
View Related
Nov 18, 2014
How do I go about getting data from a:
Text field in Form 1
Clicking a button to run VBA code, and Automatically inserting it into a refreshed combo box in Form 2
I've also attached a pic.
*Also, I'm using Access 2007...
View 5 Replies
View Related
May 24, 2005
I apologize if this has probably been asked countless times; however, in my search of this forum I could not find something that seemed to work for something so simple.
**************************************************
Scenerio:
I have 2 forms. The first form is my main form and the second form is my "popup" form. Both of these forms access the same table. In my main form I have it so people can not enter in a ID so it reduces accidental data entry. Therefore, I created a "popup" box that allows ID entry.
Everything works great except when I close out of the popup form, the newly entered data is not available unless I close the main form and reopen.
Million Dollar Question:
How do I refresh or requery (dunno the correct term usage here) the main form to reflect the addition I made in my popup form. I would like the refresh event to happen when I click the close button on my popup form.
**************************************************
Again, I know this is probably simple, but I cannot find it anywhere or most likely I am blind :cool:
Thank You
View 1 Replies
View Related
Feb 8, 2005
Hello,
I suspect this is probably rather easy, but I've not been able to figure it out:
I am using a combo to select a record in a form. This works.
The problem is: When I navigate through the records in the form, the combo box does not "update". I need to be able to change the record displayed in the combo box as the record in the form changes.
Any ideas?
Many thanks in advance for assistance.
View 8 Replies
View Related
Feb 7, 2015
I have a form that adds a record to a table in the database.I want that when i choose a value from a combobox in the form, it will change the value of another textbox according to what value was choosed.So essentially what i did is simply go to the combobox AfterUpdate and there i used this code:
If Me.Combobox.Text = "Solid" Then
Me.TextBox1.Text = "grams"
ElseIf Me.Combobox.Text = "Liquid" Then
Me.TextBox1.Text = "ml"
End If
But i encounter 2 problems:
1. When i set a default value to the textbox (which i want to), the changing of the value in the combobox doesn't do anything whatsoever.
2. When i remove any default value from the textbox, the changing of the value in the combobox does change the textbox to the corresponding value but then gives run-time error 2185: "You can't reference a property or method for a control unless the control has the focus".
View 2 Replies
View Related
Jun 12, 2014
I have a combo box control in my form named PayDateID, but I told that control to DISPLAY the associated field PayDate.
I now am trying to make a separate control in the same form whose control source is the DISPLAYED PayDate, but it only wants to reference the underlying PayDateID.
How can I make the control source be the displayed value in that combo box?
View 1 Replies
View Related
Aug 27, 2013
I have two tables - Interviews & Placements.these tables have multiple foreign keys which pull information from other tables (CandidateID,ClientID etc). I have designed queries and forms (datasheet view) which display all the values that I need, For example:
The interview form shows the following fields:
CandidateName;Company;consultant;1stInterviewDate; 2ndInterviewDate;Offer;Accepted
the placements form shows the following fields:
PlacedCandidate;Company;Consultant;PlacementDate;F ee;
This query "qry_Interviews" populates these forms using the foreign keys:
CandidateID from candidates table
CompanyID from companies table
consultant from consultants table
Ideally what I'd like to happen, is when the "accepted" field is updated on the interviews form, the placements form opens as a pop up and is auto populated with the values (CandidateName;Company & consultant).So far I have tried setting the value directly, i.e on the "on Open" event of the Placements form I entered:
Me.Txtcontactname = Forms!ISISnavigationMain!navigationSubform.Form!DS .Name
This does not work. Should I be populating the placements form with the actual Foreign key values rather than the resolved names? Ideally I'd want the pop up placements form to display the actual names rather than just ID numbers.
View 4 Replies
View Related
Mar 19, 2005
I have requested this before but the example given did not fit my situation and I had a heck of a time trying to adapt the example given to me so I will step by step describe what I need. thanks...
Can someone show me how to do the following:
1) Take a combo box that looks up a table that has 2 variables (Var1 and Var2).
2) Depending on the value chosen in the combobox (Var1) then a text field will automatically have the value (Var2) appear.
3) This information from combo box and text field will then be stored in a separate table that is linked to the form.
__________________________________________________ _____________
Also:
Is there a way to extend this example further by adding another combo box that takes the result from the first combo box to filter in values for the second combo box which will then automatically populate a text box which would then be stored in a separate table.
__________________________________________________ _____________
Someone kind of showed me before but they used unbound variables and this confused me as the combobox was unbound but how is that information stored into my table?
Pardon me for my redundancy but this is frustrating me to no end and I unfortunately have a deadline of today!!!! :(
I think it is the row source thing that confuses me. I take row source to mean where the data is stored. But where do you identify where to obtain the data to then store in your "inputed" table?
View 14 Replies
View Related
Mar 16, 2006
I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?
View 1 Replies
View Related
Mar 16, 2006
I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?
View 2 Replies
View Related
Mar 16, 2006
I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?
View 3 Replies
View Related
Dec 21, 2005
G'day. I've been browsing the forum trying to find a solution to a problem, without much luck, and am hoping that someone might be kind enough to help me more directly.
I'm a biologist and a newbie to access: with the distinction of being completely clueless about VBA. Nonetheless, I have been tasked with creating a database for storing data obtained from biological surveys of juvenile salmon and harvest/spawner surveys of adult salmon.
The bones of the db are in place and functional. The problem I have is streamlining the data entry process to minimise keystrokes/mouse clicks.
I have a subform for entering fish records with attributes such as 'species_name', 'fork_length', 'count', 'presence of tags, etc. The idea is that fish can be entered as individuals (count=1) or groups (count>1) with attribute data at the appropriate level (eg, fork lengths only entered for individuals. We typically measure the fork lengths of the first 20 individuals of each species and then tally the remainder).
One problem I face is that fish often occur in schools, and it becomes quite tiresome to click and select the same species_name combo box value for each record when entering multiple individuals of fish of the same species.
What I would like to do is set the default value for that combo box (on the fish subform) to match the value entered for the previous record.
I suspect that you could use the after update trigger to execute some code to change the default value each time something is entered manually into the combo box. Unfortunately, I know nothing about how to write the appropriate code.
Can anyone offer me some guidance?
Thanks in anticipation.
Sincerely,
Craig Dolphin
View 11 Replies
View Related
Jul 10, 2013
Ok so im working in MS Access 2007.
I want to create a query based on 3 combo boxes but have it so that if the field in the second or third combo box is not populated the query still runs.
Right now i have the Criteria set for the three columns that i wish to sort by as seen below.
Column 1
Criteria: [Forms]![Entity Selection Form]![areabox2]
Column 2
Criteria: [Forms]![Entity Selection Form]![devbox2]
Column 3
Criteria: [Forms]![Entity Selection Form]![entitybox2]
This gives me the correct query result but im forced to make a selection from each combo box. Is there a way to progamme it so that if I only make a selection from the first combobox and leave the others blank i can still get results in a query?
View 2 Replies
View Related
Jul 2, 2013
I manage an Access application that in many instances uses data selected from a combo on a form for variable criteria. In this instance it is in the form of:
[Forms]![Main Navigation]![Print Menu]![SchoolYear]
I recently wrote a routing that exports to Excel based on a record set derived from a query. In testing I hard-coded the criteria (School Year) in the query. Once everything worked I sustituted the variable above. Now, in the VBA, no records are put into the recordset, when I run the queries directly from Access they work correctly, drawing the results for the school year selected on the form referenced.
'Create The Recordset
If Me.Frame11 = 1 Then
strQueryName = "ExcelHS"
GroupTitle = "High School"
Else
strQueryName = "ExcelMS"
GroupTitle = "Middle School"
End If
Set objRst = Application.CurrentDb.OpenRecordset(strQueryName)
View 1 Replies
View Related