Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error

Status
Not open for further replies.

cneill

Instructor
Mar 18, 2003
210
GB
Hi Everyone,

I have the following code that works fine

Dim HldSID As String
HldSID = Me.Schemes & Me.Phase
Forms![FrmSchemes].Recordset.FindFirst "[SchemeID]&[PhaseID]" & HldSID
Forms![FrmSchemes].SchemeRefresh
DoCmd.Close acForm, Me.Name

but when I add an extra bit

Dim HldSID As String
HldSID = Me.Schemes & Me.Phase & Me.PhaseDiscription
Forms![FrmSchemes].Recordset.FindFirst "[SchemeID]&[PhaseID]&[SocialSchemeDiscription]= " & HldSID
Forms![FrmSchemes].SchemeRefresh
DoCmd.Close acForm, Me.Name

I get Syntax error (Missing Operator) in Expression
can anyone help

 
Hi alvechurchdata

Dim HldSID As String
HldSID = Me.Schemes & Me.Phase
Forms![FrmSchemes].Recordset.FindFirst "[SchemeID]&[PhaseID]=" & HldSID
Forms![FrmSchemes].SchemeRefresh
DoCmd.Close acForm, Me.Name

This original code should have an equals sign, by error sorry
Any other thoughts?
cneill
 

SchemeID, PhaseID, SocialSchemeDiscription, HldSID
Are they all numeric?


Randy
 
How are ya cneill . . .

The additional concatenation of [blue]SocialSchemeDiscription[/blue] is a bad idea! If there are any apostrophe's in the descriptions errors can occur.

Is there any other field you can use?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi randy700

SchemeID - Numeric
PhaseID - Numeric
SocialSchemeDiscription - Memo
HldSID - this groups all three i.e."11this is a New Phase"

I have changed SocialSchemeDiscription to a text field This did not correct the problem
any thoughts?

Thanks
cneill
 
Hi TheAceMan1

Not really but I can restict the input to just text

what are your thoughts?

thanks

CNEILL
 
cneill . . .

Try:
Code:
[blue]Forms![FrmSchemes].Recordset.FindFirst "[SchemeID]&[PhaseID]&[SocialSchemeDiscription]= [red][b]'[/b][/red]" & HldSID & "[red][b]'[/b][/red]"[/blue]


See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi TheAceMan1

After a number of tests last night I have come to the conclusion that the original code is not working correctly, so I need go back to basics, what am I actually trying to do?

The main From called FrmSchemes has a Combo Box (called AccountSchemes ) with the list of Schemes attached to an Account, (this list is provided by a query to filter the schemes attached to the account) you can select from the list the scheme you want, the FrmSchemes then changes to show various bits of information related to the Scheme selected.

Now if I what to add a new scheme to the Account, I click on a link on the FrmSchemes to open a pop up form called FrmAddNewScheme. On this form you have the following

First Combo Box has a selection of the different schemes, so you select the scheme (Combo Box is called Schemes)

Second Combo Box has a selections of the different phases, so you select the scheme (Combo Box is called Phases)

Lastly you have a Description text box, you can enter a description if required this Text Box is call PhaseDescription

So you could have selected
Scheme1 & Phase1 & entered nothing in the Description text box
You could also have Scheme1 & Phase1 & entered “Additions” into the Description text box

This information is then saved in the table called TblAccountSchemes as a new record creating a new unique auto number in the Primary Key field called “ActivityID”

Schemes are saved as a numeric in the SchemeID Field
Phases are saved as a numeric in the PhaseID Field
PhaseDescription is saved as a text in the SocialSchemeDiscription Field

I then what to requery the Combo Box (called AccountSchemes ) on the FrmSchemes to include the newly added scheme to the Combo selection, then to automatically move to that new scheme on the FrmSchemes as if I had selected it from the Combo Box (called AccountSchemes )

I hope this makes sense, can you help? If you need more info please let me know.
Thanks

cneill
 
cneill . . .

I've drawn out on paper the information in your post 14 Oct 09 2:19. It leaves me with too many questions to ask, and I expect the same for other tipsters. So I dug into your profile hoping to fill in some blanks and came up short. I did find that you've at least been working on this since Jul 4,2008 and havn't had much success here in the forums.

In the interest of time I suggest you provide a scaled down model of the db. The main interest being your tables & relationships, actual names and so forth. You can do this by uploading this scaled down db (converted to 2k if possible) to 4Shared ... [green]its free![/green] You'll be provided with a link you can use in your post. That is, if their are no proprietary issues.

Start a new thread with the info in your post 14 Oct 09 2:19 along with the link and responses should move faster for you.

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top