473,322 Members | 1,347 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,322 software developers and data experts.

selecting a different value from the one a user sees on a form

37
Hi I have a form where i have a dropdown box. The user selects either:
No
Yes-Observer
Yes-Technician
The table (LU Observer Present Lookup) that is used for the dropdown box has three fields:
ID
Observer Database Code (a number)
Observer_Present (text)

The Observer Present column is what the user selects on the form. I want to write a code that selects the Database Code that corresponds to the Observer Present selected. The ID field is the same for both entries.
I tried using Dlookup- but am not getting results


Private Sub OBSERVER__PRESENT_AfterUpdate()
Dlookup("OBSERVER DATABASE CODE",
"LU OBSERVER PRESENT LOOKUP","[ID]=
FORMS!OBSERVER PRESENT")

End Sub


Thanks for any help
Nov 3 '08 #1
3 1335
puppydogbuddy
1,923 Expert 1GB
Under Access object naming standards, you should avoid using spaces and special characters and "entire name" upper case lettering.If you do use spaces, the name must be enclosed by brackets.
http://www.acc-technology.com/namconv.htm

The above notwithstanding, your main problem is the punctuation you used in referencing the Form object.

If the [ID] field is numeric, try this syntax for the DLookup:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OBSERVER__PRESENT_AfterUpdate()
  2. Dlookup("[OBSERVER DATABASE CODE]",
  3. "[LU OBSERVER PRESENT LOOKUP]","[ID]= " & FORMS![OBSERVER PRESENT])

If the [ID] field is text, try this syntax for the DLookup:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OBSERVER__PRESENT_AfterUpdate()
  2. Dlookup("[OBSERVER DATABASE CODE]",
  3. "[LU OBSERVER PRESENT LOOKUP]","[ID]= '" & FORMS![OBSERVER PRESENT] & "'")
Nov 4 '08 #2
DonRayner
489 Expert 256MB
Hi I have a form where i have a dropdown box. The user selects either:
No
Yes-Observer
Yes-Technician
The table (LU Observer Present Lookup) that is used for the dropdown box has three fields:
ID
Observer Database Code (a number)
Observer_Present (text)

The Observer Present column is what the user selects on the form. I want to write a code that selects the Database Code that corresponds to the Observer Present selected. The ID field is the same for both entries.
I tried using Dlookup- but am not getting results


Private Sub OBSERVER__PRESENT_AfterUpdate()
Dlookup("OBSERVER DATABASE CODE",
"LU OBSERVER PRESENT LOOKUP","[ID]=
FORMS!OBSERVER PRESENT")

End Sub


Thanks for any help
If you base your combo box on a query you can have the query use both the
Observer_Present (text) and Observer Database Code (a number) in that order. Then on the combo box properties for data select the bound column to 2 and in the properties for format select the column count to 1.

This way the user is presented with Observer_Present(text) but the actual value of the combo box is Observer Database Code (a number).
Nov 4 '08 #3
sillyr
37
Thanks for your help. I went with the second option of changing the number of bound columns and column widths. Of course now I have a new problem. The table for the dropdown box has two columns- one is a text and the other is numeric. I tried to make a query to sum of the results, but it is not working because it thinks the values are text. Is t here a way for me to convert the values to numeric so I can sum them up.
Nov 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Franco Fellico' | last post by:
Hi everybody. Suppose to have a table dinamically created in a form where I show some information of a set of row selected in a db-table: ....... while($row = mysql_fetch_array($result)) {...
4
by: webhigh | last post by:
I¹m not sure if this a PHP question or an MySQL question but here it goes. I have a repeat region of a table called userid What I¹m trying to accomplish is being able to edit the record and...
6
by: amirkarger | last post by:
I have a simple "quickbrowse" menu that does this: <form> <select name="quickbrowse" onchange="go(this)"> <option selected value="">go to a tool...</option> <option value="#tool1">Great tool...
3
by: james.dixon | last post by:
Hi I was wondering if anyone else had had this problem before (can't find anything on the web about it). I have three select elements (list boxes - from here on I'll refer to them as 'the...
4
by: Sami | last post by:
I hope someone will tell me how to do this without having to do any VB as I know nothing in that area. I am a rank beginner in using Access. I have created a database consisting of student...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
0
by: erlajo610 | last post by:
Hello, I was wondering how to I create a web page in which a user can select what version of a form he wants. For example, if he fills out a form, I would like for the user to be able to save...
4
by: paulcrowsnest | last post by:
Hi everyone This is probably really simple, but it has me stumped. I have a form which gets its data from a table called "Dentistry", this table is linked to another table called...
4
by: hemricc2 | last post by:
I have the following simple page. I need to select the BARCODE text field everytime the page refreshes. I know this is pretty basic, but I'm just starting with Javascript. Thanks for the help. ...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.