Open Form Action from Continuous form

C

Coral

Hi

Thank you in advance for any help I receive.

I am trying to open a detail form from a contineous form where Lic_IDs
matches using a details button in the form header.

I am using the openform action as follows:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm_Softwaredetails"
stLinkCriteria = "[Lic_ID] = " & Me![Lic_ID]

With DoCmd
.OpenForm stDocName
.GoToControl Lic_ID ' text box on form with the primary key
.FindRecord Form!FrmSoftware!Lic_ID, acEntire, , acSearchAll, ,
acCurrent
End With

I recieve a error - "there is no field named '29' in the current record"
29 being my primary key value not the field name. So I know it is getting
the current record value but my findRecord syntax must be wrong.

I know if is probably something pretty simple that I'm missing. This is
also an Access Project using Sequal Database ODBC connection if that make a
difference.

I've also tried it using a command button from within the details of the
continuous form

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm_SWLicenseDetails"
stLinkCriteria = "[Lic_ID] = " & Me![Lic_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
A

Albert D. Kallal

What you have her looks ok:


stDocName = "Frm_SWLicenseDetails"
stLinkCriteria = "[Lic_ID] = " & Me![Lic_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

However, if lic_ID is a text field, then you need to surround the text with
quotes.

Remember,the LinkCriteris is a VALID SQL WHERE clause without the word
where.

So, if Lic_ID is a text field, then try:


stDocName = "Frm_SWLicenseDetails"
stLinkCriteria = "[Lic_ID] = '" & Me![Lic_ID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Note how I surrounded the text value with quotes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top