Update Selected Record in Continuous Form

basilyos

Registered User.
Local time
Today, 05:25
Joined
Jan 13, 2014
Messages
256
Hello Guys,

I Have a continuous form
when i filter the records if i get just one record everything is okey
but if i have many record and i want to run the code for the fourth line it doesnt work

this is my code
Code:
DoCmd.OpenReport "rpt_Allow_File", acViewPreview, , "[Serial_Number] = " & [Serial_Number]

and in the same time i have a query that will run based on the same serial number but it doesn't work because it update the first line in the form not the selected
 
if your use the code Inside the form, then
it will run fine.

but if your code is in Another module, it will
fail. you need to reference your form then.

DoCmd.OpenReport "rpt_Allow_File", acViewPreview, , "[Serial_Number] = " & [Forms]![yourFormName]![Serial Number]
 
i tried your solution same result
if i have for example 10 records after the search and i want to open any record it will open the first record
 
Can you confirm whether the Serial_Number field really is a Number datatype .... and not a text datatype
 
yes it's a number field

but i have another problem i mentioned above that when i run an update query also it will update the first record
not the one i want
 
Please give the SQL for the update query. Also screenshots showing your table design and a few records in datasheet view
 
i can t add images
but i will give some info
the report source is a query combination between two tables
the update query is from table to table based on the the serial number from the continuous form that doesnt work
 
How are you filtering the form?
You would need to use THAT filter in the OpenReport method to duplicate what you are seeing on the form.

The OpenReport and OpenForm have TWO ways of selecting records. They offer a FILTER argument and a WHERE argument. You would need to populate the FILTER argument with your current form's filter.
 
am filtering my form using textbox (after update)
Code:
Dim str1 As String

str1 = "[Accept_Description_Zone_Number] LIKE " & Chr(34) & "*" & Me.txt_Search.Text & "*" & Chr(34)

Form.Filter = str1
Form.FilterOn = True
Me.txt_Search.Value = ""
Me.txt_Search.SetFocus
 
am having the problem with or without the filter
if i dont filter the form so i have all my records when am trying to open any record it will open the report with the data from the first record
 
Great. Did you read the second sentence of my remark? Give it a whirl.
 
OK, taking two steps back...
1) I am guessing this is a continuous form on a parent form, is this correct?
2) How are you trying to determine [Serial_Number]? Where do you think the value is coming from?
3) Have you validated what is in [Serial_Number] prior to opening the report?
4) On which form do you have the DoCmd.OpenReport? I am going to guess it is NOT on the continuous form
 
guys thank you for your times
i resolve my problem by taking this steps
i create a new form based on the serial number (that's work fine)
and from this new form i run the queries and open the report
so everything is okey
thank you again for your time
 

Users who are viewing this thread

Back
Top Bottom