Linking form to search or create new record

GarageFlower

Registered User.
Local time
Today, 05:48
Joined
May 20, 2004
Messages
108
I have uploaded an example of my database

As you can see there are two tables and two forms.
What i want is for a user to view or enter data for a record on the first form.
And then when they are done they click the button to open up form2.
What i want to happen is for the company name/id from the record in form1 to be searched for when form2 opens and to display only the data for that record when opened. If no data exists for that record in form2/table2 then for it too create a record for that company when form2 is opened from form1

hope this makes sense and you can help

Please note this is just an example so if there is wrong naming conventions and such please ignore if there is as i just wanted to display quickly what i want to acheive
 

Attachments

Thank you, but that does not do what i require

that opens the second form up to display the data for the state selected.
Which is what i want

But the problem with your example is that if i enter a new project on form1 and then click form2 it doesnt create a record for that same project in form 2.

It creates two seperate records...

I need to be able to enter new data on the first form and the click the open form command and for form2 to display any existing information for that record for editing or if there is no existing information for it to create a new entry for that same record.

Anyone think they can help
Many Thanks
 
erm when you say function what exactly do you mean?
where would i insert the code you have just given me

im using this code from your example on the onclick event


Private Sub Label75_Click()
On Error GoTo Err_Label75_Click

Dim strFrmName As String

strFrmName = "Contract Filtered"

DoCmd.OpenForm strFrmName
With Forms(strFrmName)
.Filter = ""
.Filter = "StatesID = " & ProjectName
.FilterOn = True
End With

Exit_Label75_Click:
Exit Sub

Err_Label75_Click:
MsgBox Err.Description
Resume Exit_Label75_Click

End Sub

where would i place this new code as you suggested?

Many Thanks
 
nope still not working

if i enter a new record on form1 and then click form2 it just opens up at another record with some sort of error message

Any ideas?
 
I have done this and it still does not work?

any more ideas?

thank you
 
could you upload that for me please?

that is exactly what i did

and it didnt work as you saw by my second upload

thank you
 

Users who are viewing this thread

Back
Top Bottom