Solved Query from subform

ilanray

Member
Local time
Today, 20:40
Joined
Jan 3, 2023
Messages
129
Hi
I have a main-form called X and subform called y, When I click on the subform I sent an ID to x form to textbox object.so far it works fine
I have a table called z. I would like to load all field froim z table that related to the id in my textbox. when I display the textbox I can see that the value is chaging everytime I click on a different value in the y form
something like:
Code:
 "select id,firstname,latname from z where id=" & textbox.value
for some reason it doensn't recognize the id at the query
Can someone help me?
 
is "z" form a subform also in "X" form?

you add a Link Master/Child Fields to subform "z":

Link Master Fields: [y]![Form]![ID]
Link Child Fields: theForeignKeyName
 
What are table relationships? Is z.id an autonumber PK or a number FK?

You show an SQL statement but where is it used?
 
z is not a subform it just a table that I would like to use to take the firstname and lastname
id is a PK autonumber
the query is at themain form a
I tried to put the sql in the load event or at the current event and it does't work
 
you can't use SQL to retrieve info from a Table on a form.
did you try using DLookup() or use VBA (recordset) to retrieve the info?
 
ok 2 issued:
1. i tried to do
Code:
[forms]![main_menu]![NavigationSubForm].[form]![tttt].value=12
value=12 it just a number for testing and it workd fine
I am trying to do the same expressinn vut with variable and it doen'nt work. the both on the same form
Code:
[forms]![main_menu]![NavigationSubForm].[form]![tttt].value=[forms]![main_menu]![NavigationSubForm].[form]![id1].value
id1 is the id that I sent from the y form (y is the subform) which I remind you it id is changing everytime I choose a different record

2. How do I make it onliine changing. I mean in what event should I put it?
 
Why would two fields in same table have same data?
 
Again, what are you trying to do?
can you Not just Create a Query:

select id, id as tttt from yourtable;

and create a form out of the query and use it as your subform.
 
Why would two fields in same table have same data?
the dont' habe the same data. I have an id in textbox lets call it ID1 and I would like to fill in another textbox lets call it tttt with "firstname" of the same id
 
ok let me try to explain again. I have main whch have navigaion bar. and when I click on on of the botton (navigationFormButton9) I get the form I created called F_AllTaskFrame. so far ir doen't realy related to the problem
in F_AllTaskFrame i have field and subform called F_Title .
in F_title Subform I have some id's. when I click on one of the values it sent the ID to the main form (F_AllTaskFrame)

now on the F_AllTaskFrame i have lots of field and I would like to fill them regardinf to the ID whiich I have and see it on textbox called ID1
 
"fill them" - do mean apply filter criteria to retrieve data?

Perhaps you should provide database for analysis. Follow instructions at bottom of my post.
 
I solved the problem with DLOOKUP. but now I have another problem
since I have 20 textbox's to fill with data it works slow since it run DLOOKUP for every textbox
any ideas?
 
Counter question: Have you ever looked into a book or a tutorial? My suggestion: do it.

All teaching material that does not contain any information can be thrown in the dustbin. The rest then overwhelmingly contains your desired information.

Access is a development environment. A developer should therefore work with some seriousness of his own, i.e. be able to look at the basics himself.
 

Users who are viewing this thread

Back
Top Bottom