473,385 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 HandleButtonClick 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 HandleButtonClick_Err
Dim AccAllow As Variant

Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)

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

Select Case rst![Command]

' Go to another switchboard.
Case conCmdGotoSwitchboard

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 1341
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
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...
9
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...
5
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...
3
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...
5
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...
1
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...
10
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...
2
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...
7
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 = ...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.