button to click on a selected record

val_87

Registered User.
Local time
Yesterday, 16:55
Joined
Sep 23, 2015
Messages
38
Hey all.

Now attached is a screenshot of a main form.
I have a button there to start a new record, which works, but if i wanted to create a button to view a specific record i run in to an issue.

I need to write a piece of code in to event procedure to open a record selected from that table.

I have tried this:

DoCmd.OpenForm "full_personal_details", , , "Id = " & Me!Baby ID

Apparantly it is not working, what is wrong in that piece of code?

And as you can see from screenshot, the query that is bringing info to the main form table is displaying same records all over again. Can i fix that somehow?

Thank you for your help!
 

Attachments

  • VB_mistake.jpg
    VB_mistake.jpg
    101 KB · Views: 69
you cant have spaces in names.
rename the text box BabyID, and adjust the code, and it will work.
 
you cant have spaces in names.
rename the text box BabyID, and adjust the code, and it will work.


Thank you! I will do so.
Do you maybe know why query is repeating information?
 
or

DoCmd.OpenForm "full_personal_details", , , "Id = " & Me![Baby ID]

... assuming the argument you are using is correct.

If you are getting all records returned, I assume there is something wrong, to be honest.

Are you sure the control/field is [id]
 
or

DoCmd.OpenForm "full_personal_details", , , "Id = " & Me![Baby ID]

... assuming the argument you are using is correct.

If you are getting all records returned, I assume there is something wrong, to be honest.

Are you sure the control/field is [id]

Yep it was.
I just enraged and deleted the damn button.
I will email it to personal email and give it a go at home tomorrow.
I will post back! :)
I will remove spaces from the column names.
 

Users who are viewing this thread

Back
Top Bottom