Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tabbed forms not setting variables 1

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
I have a form that has 3 tabs. ON each tab, there are at least 2 subforms. ON the main form, I have a combo box for getting the inspectors name.
What I am trying to do is take the inspector name from the combo box and put it in the first field in each subform (to make sure that the correct inspector is getting credit for the work)
On the first tab, it shows up in one subform but I get an error message saying it can't find hte field on the second form. I have checked the form for spelling errors etc but all looks well.
CAn someone see what I'm doing wrong??
the code I'm using is
Code:
  txtmainwsscid = Me.cboLookUp.Column(3)
'make sure person logged in or selected in drop down box is passed
Me!frmReports.Form!Txtcboselected = Me!cboLookUp.Value
Me!frmSbDataEntry.Form!EmployeeName = Me!cboLookUp.Value
'Me!frmSbEquipRprTstBench.Form!EmployeeName = Me!cboLookUp.Value
'Me!frmSbFHMetersRepaired.Form!EmployeeName = Me!cboLookUp.Value
'Me!frmSbMeterTestingResults.Form!EmployeeName = Me!cboLookUp.Value
'Me!FrmSbLrgMetersIssued.Form!EmployeeName = Me!cboLookUp.Value
'Me!frmSbMeterCrates.Form!EmployeeName = Me!cboLookUp.Value
Me!FrmSbMetersInStock.Form!EmployeeName = Me!cboLookUp.Value
'Me!frmSbScrappedMeters.Form!EmployeeName = Me!cboLookUp.Value

The lines that are commented out are the ones that are not working.
Thanks for any help.
lhuffst
 
1.Yes I changed the master/child like properties to : Parent = txtuserid Child = userid. I did pass the userid to txtuserid from the login screen.
2. Yes it was a paste error, it should say tblYesNos
 
Name: cbouser
Row Source: SELECT TblUsers.UserId, TblUsers.WSSCID, TblUsers.FullName, TblUsers.WorkGroupID, TblUsers.UserPwd, TblUsers.PWReset, TblUsers.UserType FROM TblUsers WHERE (((TblUsers.UserType)="work")) ORDER BY TblUsers.[FullName];
column count: 7
Column Widths: 1"
Bound Column: 1

Note: On the part that I sent for the field names on tblusers, I did not put in all of the fields as I was just trying to show the PK/FK's and I'm hoping to remove most of the fields from that table if they are not necessary such as having fullname and last name, first name should not be necessary. If you need all of the fields, I can put them in.

The rowsource is correct for the fields and I have them all at 1" right now so I can make sure it's retrieving correct data. I plan to make all of them 0 except FullName after testing.
 
I thought we were talking about a single main form with multiple subforms.

Lhuffst said:
I have a form that has 3 tabs. ON each tab, there are at least 2 subforms. ON the main form, I have a combo box for getting the inspectors name.

What do you mean by "another form"?

Duane
Hook'D on Access
MS Access MVP
 
the mainform is a single form with multiple subforms but the login page is separate. I was passing that value to a text box on the mainform using a global variable and the subforms as well. I'm apologize if I didn't explain that well enough.

The requirement was that the inspectors can only see their data but their supervisors can see everyones data. To accomodate this, I had a text box on the mainform that captured their name from the login form and that field is what was linked to the subforms. I thought that if the person who logged on was a supervisor, then I would show a combo box on the mainform so they could pick individual inspectors names and see their info.

does that sound reasonable?
 
I just tried to do some data entry on one form to see if it kept the id and this is what I found.
1. If I do not pass the id number to a text box, then it doesn't store it in the table
2. If I pass the id number to a text box, it stores it in the table but I also get a blank record as well so it stores 2 records at a time.
Odd!
 
Why do you think you need to continue to pass "names"? Always use the primary/foreign key values. You should pass the UserID from the login form to the combo box and then set up the link master/child to the combo box and UserID. The combo box row source should be a query that selects only the single employee or multiple employees if the logged in user is a supervisor.

Duane
Hook'D on Access
MS Access MVP
 
I'm not passing the name anylonger based on your email. I am passing the id. I will change the combobox and let you know how that work. Thank you again.
 
ok I have the combo box working now (whew)but I have a question.
1. If you pass a value to the combo box and not the recordset, will it automatically use that value to get the recordset? I"m guessing not.
2. I still have the problem of getting 2 records per subform table. Does a form open to add new by default?

Thank you for all the help you have given me. I finally feel like I'm on the right path :)
 
Duane - thanks for straightening me out. I had missed removing the code from one of the subforms hence the two records. All is well now thanks again.

I did try to read your survey sample listed in another post but was unable to retrieve it.
www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane

I have this project working now except for the last thing they threw at me. Based on the stats from subforms, they want me to determine if the inspectors have met their goals during the year. I have a table that lists goals (goal id, goal text) and a table that has ranking info for each goal.
Code:
tblGoals
 Goalid
 GoalText

tblRanking
 Rankid
 Goalid
 RankNumber  (1-5)
 RankText     (splits %'s)
it ends up

Goal 1 Login to system every day by COB
Rank 5 - 99.1% to 100% of the time​
Rank 4 - 97.6% to 99% of the time​
....

What the customer requested yesterday was a way to create the inspector's ranking for each goal. To do this, I have to count the number of entries made during a given timeframe but how do I link the goals to the table that has the actual data? Since some of the goals can be in multiple tables, it didn't seem feasible to put a goalid field in each table but I wasn't sure.
Thanks again
 
My stuff can be found at Rogers Access Library.

Stats aren't in "subforms" they are in tables. I'm confused by your requirements. Perhaps you need a query like:

SQL:
SELECT InspectorID, Count(*) as NumOf, 1 as GoalID 
FROM tblInspectorActions
WHERE ActionDate Between #1/1/2015# AND #3/31/2015#
GROUP BY InspectorID;



Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top