Baffled?

Sam Summers

Registered User.
Local time
Today, 19:23
Joined
Sep 17, 2001
Messages
939
I think i may be missing something simple here?

I have a form that uses this query-

SELECT Equipment.EquipmentID, EquipLookup.EquipDescription, Location.JobNo, Equipment.LocationID, Equipment.EquipRef, Equipment.ItemNo, Equipment.TestDate, Equipment.Scrapped, Equipment.Lost
FROM Location INNER JOIN (EquipLookup INNER JOIN Equipment ON (EquipLookup.EquipRef = Equipment.EquipRef) AND (EquipLookup.EquipRef = Equipment.EquipRef)) ON (Location.LocationID = Equipment.LocationID) AND (Location.LocationID = Equipment.LocationID)
WHERE (((Location.JobNo)=[Forms]![FindbyLocation]![Item].[Text]) AND ((Equipment.Scrapped)=False) AND ((Equipment.Lost)=False))
ORDER BY EquipLookup.EquipDescription;

I then open another form (ReCertify) that contains the activeX MS.Cal date picker using this code-

stDocName = "ReCertify"
'stLinkCriteria = "[LocationID]=" & Me![LocationID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
ReCertify.SetFocus
Forms!ReCertify!ReCertify.Visible = True
Forms!Main!JobNo.Visible = False
Forms!Main!Label172.Visible = False

This form also contains a textbox 'InspBy' and when the user clicks on the ReCertify button, this code is executed

Date.SetFocus
If [Date].Text = "" Then
Msg = "Please click on a Date"
Style = vbOKOnly + vbExclamation
Title = "Select a Date" ' Define title.
Response = MsgBox(Msg, Style, Title)
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenQuery "ReCertify", acNormal, acEdit
DoCmd.OpenQuery "LastTestqry", acNormal, acAdd
Me.Label102.Visible = False
Me.InspBy.Visible = False
stDocName = "VisualExamDetails"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "ViewbyLocation"
DoCmd.Close acForm, "ReCertify"

The problem is that the date is inserted correctly but the name is blank?

The 'ReCertify' Query SQL reads as such-

UPDATE Equipment SET Equipment.TestDate = [Forms]![ReCertify]![Date].[Text], Equipment.InspectedBy = [Forms]![ReCertify]![InspBy].[Text]
WHERE (((Equipment.LocationID)=[Forms]![ViewbyLocation]![LocationID]));

and the 'LastTestqry' Query reads as this-

INSERT INTO AccessInspHistory ( ReCertDate, EquipmentID, InspectedBy )
SELECT Equipment.TestDate, Equipment.EquipmentID, Equipment.InspectedBy
FROM Equipment
WHERE (((Equipment.LocationID)=[Forms]![ViewbyLocation]![LocationID]));

I jsust can't understand why the date is inserted but the name is not?

Thank you in advance!
 
To return a control's Text property, the control must have the focus. But at any time, only one control on a form can have the focus.


Try removing .[Text] from [Forms]![ReCertify]![InspBy] in the Update query.
 

Users who are viewing this thread

Back
Top Bottom