473,657 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use a variable to get a controls value.

Kev
Hello All,
I am attempting to use the variable "AccAllow " which is populated by
opening a recordset. I am using AccAllowed to refer to a control on
the active form (the Switchboard) but I am having difficulty with the
syntax.
AccessAllowed is a text field in the Switchboard items table. I am
trying to modify the HandleButtonCli ck function in the Switchboard
form. The AccessAllowed field is the name of one of many hidden text
controls on the Switchboard form. This control's value is either a 1
or 0 not "1" or "0"

Could someone please help.? I am not sure what I should be declaring
the AccAllow variable as.

Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonCli ck_Err
Dim AccAllow As Variant

Set dbs = CurrentDb()
Set rst = dbs.OpenRecords et("Switchboar d Items", dbOpenDynaset)

rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND
[ItemNumber]=" & intBtn
AccAllow = "Me!" & rst![AccessAllowed]

Select Case rst![Command]

' Go to another switchboard.
Case conCmdGotoSwitc hboard

If AccAllow = 1 Then
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst!
[Argument]
Else
MsgBox "you don't have access to this function"
Exit Function
End If

Cheers Kevin
Apr 8 '08 #1
1 1361
Kev
For anyone interested, the solution was simple - Bobby Heid came up
with the answer

I needed to replace this line

AccAllow = "Me!" & rst![AccessAllowed]
with this line

AccAllow = me(rst![AccessAllowed])

Regards
Kevin
Apr 10 '08 #2

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

Similar topics

2
2328
by: Ronny Sigo | last post by:
Hello all, I have made a form which takes input from the user (things like name,adress, reference number and so on). After filling in the form, the user presses a button. The program then takes all the values out of the controls, opens MS Word and uses these values to compose a letter with all the data pre-filled in. Now my question is : Can I make a variable, containing some text which comes out of the controls of the form and use this...
9
3130
by: Shapper | last post by:
Hello, I am declaring a variable in my aspx.vb code as follows: Public Class catalogue Public productid As String Private Sub Page_Load ... I have an image button where I call the following function:
5
1534
by: tino | last post by:
Years ago there used to be a feature in dBase and FoxPro where the content of a variable could be used a variable name: Var1 = "Var2" Var2 = blank &Var1 = "Hallo" this way Var2 would get the value "Hallo" assigned. By prefixing Var1 with the empersand the program would use
3
1450
by: a | last post by:
Hey gang! I have a specific problem, but a general answer may help. I am building a web app which will display multiple UserControls on the screen. I want to put them in a table that is X Columns by however many rows it takes to complete the list. I essentially need to add dim a new row, then a new cell, and continue adding cells to the row until i get to the max_rows property, then add that row to the table, dim a new row, and...
5
1129
by: rodchar | last post by:
Hey all, Given: strVal1 = array.getvalue(0) Is there a way I can have a variable in place of strVal1 that will point to strVal1. I guess what I'm asking is if there's a way to make a variable point to another variable?
1
3858
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. Does this approach sound feasible or are there better alternatives? My problem is that I don't...
10
1439
by: Mark A. Sam | last post by:
Hello, I am using Visual Web Developer and decared a Public Variable in the Class section. I assigned a value in the load section, and on a button I set it up to increment, but it always delivers the same value, 1. When I increment the variable from the button, shouldn't it hold the new value? I also tried declaring the variable as a Friend, but it wasn't any more friendly. ;) Partial Class test
2
1259
by: mattdaddym | last post by:
Hi, I have a variable question in regards to my asp .net page. I need to declare a variable whose value is readable/writable to all of the subroutines of a specific page. So far I have one of two problems. The first is if I declare my variable right after the class definition, then I can use it anywhere, but the value does not persist from one subroutine to the next.
7
5713
by: John Smith | last post by:
Hello, I have a simple question, I have a vb.net form with several buttons. If I store the name of a button in a variable.. Dim TheName as string TheName = Me.btnMyLittleButton.Name.ToString How can I disable this button using the variable value?
1
1934
by: Froefel | last post by:
I'm trying to populate a gridview control based on a user's search criteria, but what seemed like a trivial task turns out to be a nighmare for this newbie... maybe someone can help. Here's the (simplified) business requirement: 1. Allow the user to specify search criteria (country, action, status) 2. Display results of the search in a gridview, after the using clicks the search button. 3. Allow paging and sorting on the gridview 4....
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.