Control source properties for combo box (1 Viewer)

mounty76

Registered User.
Local time
Today, 04:31
Joined
Sep 14, 2017
Messages
341
Hi All,

I have a combo box that looks up values in a tbl.

Is there a way in the combo box control that I can change which values it shows for different FE users? But without having different queries to designate the criteria? I thought I could just use a query and control the combo box with that query, but when I do that then it throws up issues with other controls I have on the form that has a control source being the main tbl.

Any ideas?
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:31
Joined
Sep 21, 2011
Messages
14,051
You can set it on form load, just use whatever logic you need?
 

mounty76

Registered User.
Local time
Today, 04:31
Joined
Sep 14, 2017
Messages
341
OK. So I've a combo box called Budget Code, this shows a list from tblBudget![Budget Code], what logic would I need to only show budget codes that start "0.*" (text value)?
 

bob fitz

AWF VIP
Local time
Today, 11:31
Joined
May 23, 2011
Messages
4,717
I thought I could just use a query and control the combo box with that query, but when I do that then it throws up issues with other controls I have on the form that has a control source being the main tbl.
Can you show us the SQL Statement used for the combo
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:31
Joined
Sep 21, 2011
Messages
14,051
OK. So I've a combo box called Budget Code, this shows a list from tblBudget![Budget Code], what logic would I need to only show budget codes that start "0.*" (text value)?
Who can tell what your logic is? :(
If whatever then
cboControl.Rowsource = "SELECT field1, field2, from yourTable where YourField Like "0*"
Else
cboControl.Rowsource = "SELECT field1, field2, from yourTable "
End If
 

LGDGlen

Member
Local time
Today, 11:31
Joined
Jun 29, 2021
Messages
229
can you not add criteria to your controls query?

select the combo box, click on data property and select row source and then select the field and add a criteria

e.g.:

1633086737356.png
 

LGDGlen

Member
Local time
Today, 11:31
Joined
Jun 29, 2021
Messages
229
@Gasman apologies, i saved and then thought i'd expand what i said with an example so edited
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:31
Joined
Feb 19, 2013
Messages
16,553
Your second post would require a different solution to your first post. However you have not said how you identify a user or whether the rule is specific to each user or groups of users. Which has an impact on what the solution might be. Suggest you provide that information together with some example data to illustrate.
 

mounty76

Registered User.
Local time
Today, 04:31
Joined
Sep 14, 2017
Messages
341
Each FE user just has the same FE but with differing options on the main form (I don't have seperate log ins etc, for them, just their FE version has a slightly different form to the others). I have the following setup:

tblExpenses
tblCodes

tblExpenses has a lookup field that looks up a budget code

The data entry form I have made is based on tblexpenses and updates this tbl when users add new expenses. There is a combo box on that form that you can select the budget code.

tblCodes looks like this:

ID Budget Code
1 0.01 Travel
2 0.02 Accomoodation
3 0.03 XXXX
4 1.01 XXXX
5 1.02 XXX
6 2.01 XXXX
etc..

I would like to make an adjustment to each FE users form whereby it only shows the budget codes I want it to for that particular FE? Hope that makes sense? So one FE users form will just have 1.* codes and another user might have 3.* and 7.* etc..
 

mounty76

Registered User.
Local time
Today, 04:31
Joined
Sep 14, 2017
Messages
341
Who can tell what your logic is? :(
If whatever then
cboControl.Rowsource = "SELECT field1, field2, from yourTable where YourField Like "0*"
Else
cboControl.Rowsource = "SELECT field1, field2, from yourTable "
End If
Sorry not all access wizards....trying to do this alongside a day job
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:31
Joined
Sep 21, 2011
Messages
14,051
Each FE user just has the same FE but with differing options on the main form (I don't have seperate log ins etc, for them, just their FE version has a slightly different form to the others). I have the following setup:

tblExpenses
tblCodes

tblExpenses has a lookup field that looks up a budget code

The data entry form I have made is based on tblexpenses and updates this tbl when users add new expenses. There is a combo box on that form that you can select the budget code.

tblCodes looks like this:

ID Budget Code
1 0.01 Travel
2 0.02 Accomoodation
3 0.03 XXXX
4 1.01 XXXX
5 1.02 XXX
6 2.01 XXXX
etc..

I would like to make an adjustment to each FE users form whereby it only shows the budget codes I want it to for that particular FE? Hope that makes sense? So one FE users form will just have 1.* codes and another user might have 3.* and 7.* etc..
Well, I'd expect you would need a table to identify what user works what? Is that all the time or per day? If per day, you would need the date in there as well?
Seems overly complicated to me.? Why not just tell the user you are working 1 & 3s today.?

In a bank I worked at, the Flow Leader assigned cases to a user, and that was all they got to see? You could perhaps use the same logic?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:31
Joined
Feb 19, 2013
Messages
16,553
Each FE user just has the same FE but with differing options on the main form (I don't have seperate log ins etc, for them, just their FE version has a slightly different form to the others).
this seems complicated - so you are maintaining multiple different front ends because of a few changes to a form depending on which machine it is on? So user A goes to the machine of user B and will see what user B would see?

I would like to make an adjustment to each FE users form whereby it only shows the budget codes I want it to for that particular FE?

Assuming you are continuing down the (what will be high maintenance) route of slightly different FE's for different users just adjust the query for that particular user. as per gasman's suggestion.

You could adjust the sql by including a tempvar called say 'BudgetGroup'

You would populate it when the app is first opened

tempvar!budgetgroup="0"
or
tempvar!budgetgroup="0"
whatever

then your query would be something

SELECT * FROM myTable WHERE budgetcode like tempvar!budgetgroup & "*"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:31
Joined
Feb 19, 2002
Messages
42,981
Each FE user just has the same FE but with differing options on the main form (I don't have seperate log ins etc, for them, just their FE version has a slightly different form to the others). I have the following setup:
OK, we're unanimous. This is not a good idea. Sounds like you need a log in table and some way to identify his "group" or whatever. There needs to be a way to define that groupA sees Items 1-4. GroupB sees 1, 4-6, and GroupC sees everything.

I've attached a database that uses a menu that might give you some ideas. If you log in as a different user, you see different menu items. You want to take it further to control combos. That is certainly doable. We just need to know the rules.
 

Attachments

  • SwitchboardFormWithLogin.zip
    1.6 MB · Views: 268

Users who are viewing this thread

Top Bottom