INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

Querying by value in form field.

Querying by value in form field.

(OP)
I know there has to be a way to do this, but I just can't seem to find it. Is there a way to form a query using the data displayed in a field in a form as the criteria? In Access I would just use Form![fieldname, or something to that affect.

RE: Querying by value in form field.

If you find the answer, I would like it too. A way was indicated to me by someone in the DB Community a while back, but it was far above my skill level at that time.

I found another way on line, which involves entering code for every field, and I bookmarked it somewhere. If I can find it, I will share. I have attempted to do it in a quick and dirty fashion, by attaching the form to the qbe instead of db, but it doesn't work.  

RE: Querying by value in form field.

(OP)
I have tried the same thing. No luck. I assume it will take a bit of SQL, which is fine, just need to figure it out, or find someone who knows how to do it.

RE: Querying by value in form field.

You can easily use a variable in a query using the ~ followed by the variable name such as ~fieldVariable. To use the value of a field set a variable to the fields value then use the variable in the query. You can't use the field's value directly in a query.

I haven't used Paradox in a while so if this doesn't make sense let me know and I'll post an example.

RE: Querying by value in form field.

(OP)
My apologies, but I think I may need that example. Where do I set the field variable? How do I use the variable in a query where the variable equals the value in the field as displayed on a form?

Also, while I have someone who knows how to do this, say instead of a query, I would like to open another form, or report, where the form or report displays information in other tables regarding the individual, or case number, displayed in a form field. Let me explain. I have several tables established. One of them, say General.db, holds general information regarding a case. We keep track of all our cases by a case number. Another table, say Motions.db, holds information regarding motions for each case. A new record row is created with each new motion, but the case number repeats. Both tables use composite keys which includes the case number.

I have a form set up to display the general information of a case, including the case number. I want a button to push to open the motions form, which I can do. But I want it to open to the motions in the case number displayed in the general information form, which I can't do.

RE: Querying by value in form field.

Maybe this example will be usefull to you!

It's a partial query I use in an app. to build a answer table for a view!
testOE is a variable used as "variable" column name.
All names with ~ in front are variables.
All names with _ in front are table "connectors".

CODE

testOE = "S"+chrOEM(155)+"genavn"

qbe = Query

    Firma.db    | Kontonr    | ~testOE     | Navn       | Adresse1   | Adresse2  | Postnr |
                | Check _Kto | Check ~SNam | Check ~Nam | Check ~Adr | Check     | _Pst   |

    Kontakt.db  | Kontonr | Lbnr  | Kontakt     | Telefon    |
                | _Kto    | Check | Check ~Att  | Check ~Tlf |

    Postnr.db   | Postnr     | By        |
                | Check _Pst | Check ~By |

    Repair.db   |Kontonr|Garanti  |Hardware  |Fejltype  |Status    |
                |_Kto   |Check ~xG|Check ~Hdw|Check ~Ser|Check ~Sts|

endQuery

Hope this will help you!
I'm not here that often but I still develop in Pdox9 :)
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close